0byt3m1n1
Path:
/
data
/
applications
/
aps
/
tikiwiki
/
7.0-0
/
standard
/
htdocs
/
lib
/
core
/
Tracker
/
Field
/
[
Home
]
File: Computed.php
<?php // (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id: Computed.php 33551 2011-03-19 08:02:45Z pkdille $ /** * Handler class for Computed * * Letter key: ~C~ * */ class Tracker_Field_Computed extends Tracker_Field_Abstract { function getFieldData(array $requestData = array()) { global $prefs; if ($prefs['tracker_field_computed'] != 'y') { return array(); } $ins_id = $this->getInsertId(); $data = array(); if (isset($requestData[$ins_id])) { $value = $requestData[$ins_id]; } else if ($this->getItemId()) { $fields = $this->getTrackerDefinition()->getFields(); $values = $this->getItemData(); $option = $this->getOption(0); if ($option) { $calc = preg_replace('/#([0-9]+)/', '$values[\1]', $option); // FIXME: kill eval() eval('$computed = ' . $calc . ';'); $value = $computed; $trklib = TikiLib::lib('trk'); $infoComputed = $trklib->get_computed_info( $this->getOption(0), $this->getTrackerDefinition()->getConfiguration('trackerId'), $fields ); if ($infoComputed) { $data = array_merge($data, $infoComputed); } } } $data['value'] = $value; return $data; } function renderOutput($context = array()) { return $this->renderTemplate('trackeroutput/computed.tpl', $context); } function renderInput($context = array()) { return $this->renderOutput($context); } }