當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tracker_Definition類代碼示例

本文整理匯總了PHP中Tracker_Definition的典型用法代碼示例。如果您正苦於以下問題:PHP Tracker_Definition類的具體用法?PHP Tracker_Definition怎麽用?PHP Tracker_Definition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Tracker_Definition類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: action_add

 function action_add($input)
 {
     $trackerId = $input->trackerId->int();
     $definition = Tracker_Definition::get($trackerId);
     if (!$definition) {
         throw new Services_Exception_NotFound();
     }
     $delayAfter = abs($input->after->int() * $input->after_unit->int());
     $delayNotif = abs($input->notif->int() * $input->notif_unit->int());
     $from = $input->from->word();
     $to = $input->to->word();
     $event = $input->event->word();
     $subject = $input->subject->text();
     $body = $input->body->text();
     $todolib = TikiLib::lib('todo');
     if (!$delayAfter) {
         throw new Services_Exception_MissingValue('after');
     }
     $todoId = $todolib->addTodo($delayAfter, $event, 'tracker', $trackerId, array('status' => $from), array('status' => $to));
     if ($delayNotif) {
         $detail = array('mail' => 'creator', 'before' => $delayNotif);
         if ($subject) {
             $detail['subject'] = $subject;
         }
         if ($body) {
             $detail['body'] = $body;
         }
         $todolib->addTodo($delayAfter - $delayNotif, $event, 'todo', $todoId, "", $detail);
     }
     return array('trackerId' => $trackerId, 'todoId' => $todoId);
 }
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:31,代碼來源:TodoController.php

示例2: smarty_function_trackerfields

function smarty_function_trackerfields($params, $smarty)
{
    if (!isset($params['fields']) || !is_array($params['fields'])) {
        return tr('Invalid fields provided.');
    }
    if (!isset($params['trackerId']) || !($definition = Tracker_Definition::get($params['trackerId']))) {
        return tr('Missing or invalid tracker reference.');
    }
    $sectionFormat = $definition->getConfiguration('sectionFormat', 'flat');
    switch ($sectionFormat) {
        case 'tab':
            $title = tr('General');
            $sections = array();
            foreach ($params['fields'] as $field) {
                if ($field['type'] == 'h') {
                    $title = tr($field['name']);
                } else {
                    $sections[$title][] = $field;
                }
            }
            $out = array();
            foreach ($sections as $title => $fields) {
                $out[md5($title)] = array('heading' => $title, 'fields' => $fields);
            }
            $smarty->assign('sections', $out);
            return $smarty->fetch('trackerinput/layout_tab.tpl');
        case 'flat':
        default:
            $smarty->assign('fields', $params['fields']);
            return $smarty->fetch('trackerinput/layout_flat.tpl');
    }
}
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:32,代碼來源:function.trackerfields.php

示例3: wp_fixture_tracker_data

function wp_fixture_tracker_data($data, $params, $mock)
{
    $table = new FixtureTable($data);
    $headings = $table->getHeadings();
    $trackerId = $params->trackerId->int();
    $tracker = Tracker_Definition::get($trackerId);
    if (!$tracker) {
        return '__' . tr('Tracker not found.') . '__';
    }
    $smarty = TikiLib::lib('smarty');
    $smarty->loadPlugin('smarty_modifier_sefurl');
    $url = smarty_modifier_sefurl($trackerId, 'tracker');
    $table->setTitle(tr('Tracker Data for [%0|%1]', $url, $tracker->getConfiguration('name')));
    if (!in_array('itemId', $headings)) {
        return '__' . tr('Table must contain at least one field named itemId') . '__';
    }
    foreach ($headings as $permName) {
        if ($permName != 'itemId' && !($field = $tracker->getFieldFromPermName($permName))) {
            return '__' . tr('Tracker Field not found: %0', $permName) . '__';
        }
    }
    foreach ($table as $row) {
        $fields = array_combine($headings, $row);
        $itemId = $fields['itemId'];
        unset($fields['itemId']);
        $mock->addValues($itemId, $fields);
    }
    return $table;
}
開發者ID:linuxwhy,項目名稱:tiki-1,代碼行數:29,代碼來源:wikiplugin_fitnesse.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('Importing tracker...');
     $lib = \TikiLib::lib('tabular');
     $info = $lib->getInfo($input->getArgument('tabularId'));
     $perms = \Perms::get('tabular', $info['tabularId']);
     if (!$info || !$perms->tabular_import) {
         throw new \Exception('Tracker Import: Tabular Format not found');
     }
     $fileName = $input->getArgument('filename');
     if (!file_exists($fileName)) {
         throw new \Exception('Tracker Import: File not found');
     }
     // from \Services_Tracker_TabularController::getSchema TODO refactor?
     $tracker = \Tracker_Definition::get($info['trackerId']);
     if (!$tracker) {
         throw new \Exception('Tracker Import: Tracker not found');
     }
     $schema = new \Tracker\Tabular\Schema($tracker);
     $schema->loadFormatDescriptor($info['format_descriptor']);
     $schema->loadFilterDescriptor($info['filter_descriptor']);
     $schema->validate();
     if (!$schema->getPrimaryKey()) {
         throw new \Exception(tr('Primary Key required'));
     }
     // this will throw exceptions and not return if there's a problem
     $source = new \Tracker\Tabular\Source\CsvSource($schema, $fileName);
     $writer = new \Tracker\Tabular\Writer\TrackerWriter();
     $writer->write($source);
     $output->writeln('Import done');
     return 0;
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:32,代碼來源:TrackerImportCommand.php

示例5: infobox_trackeritem

 private function infobox_trackeritem($input)
 {
     $itemId = $input->object->int();
     $trklib = TikiLib::lib('trk');
     if (!($item = $trklib->get_tracker_item($itemId))) {
         throw new Services_Exception_NotFound();
     }
     if (!($definition = Tracker_Definition::get($item['trackerId']))) {
         throw new Services_Exception_NotFound();
     }
     $itemObject = Tracker_Item::fromInfo($item);
     if (!$itemObject->canView()) {
         throw new Services_Exception('Permission denied', 403);
     }
     $fields = array();
     foreach ($definition->getPopupFields() as $fieldId) {
         if ($itemObject->canViewField($fieldId) && ($field = $definition->getField($fieldId))) {
             $fields[] = $field;
         }
     }
     $smarty = TikiLib::lib('smarty');
     $smarty->assign('fields', $fields);
     $smarty->assign('item', $item);
     $smarty->assign('can_modify', $itemObject->canModify());
     $smarty->assign('can_remove', $itemObject->canRemove());
     $smarty->assign('mode', $input->mode->text() ? $input->mode->text() : '');
     // default divs mode
     return $smarty->fetch('object/infobox/trackeritem.tpl');
 }
開發者ID:hurcane,項目名稱:tiki-azure,代碼行數:29,代碼來源:Controller.php

示例6: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('<info>Clearing tracker...</info>');
     $trackerId = $input->getArgument('trackerId');
     $tracker = \Tracker_Definition::get($trackerId);
     if (!$tracker) {
         throw new \Exception('Tracker Clear: Tracker not found');
     }
     $perms = \Perms::get('tracker', $trackerId);
     if (!$perms->admin_trackers) {
         throw new \Exception('Tracker Clear: Admin permission required');
     }
     $confirm = $input->getOption('confirm');
     $utilities = new \Services_Tracker_Utilities();
     if ($confirm) {
         $utilities->clearTracker($trackerId);
         $output->writeln('<info>Tracker clear done</info>');
     } else {
         $name = $tracker->getConfiguration('name');
         $output->writeln("<info>Use the --confirm option to proceed with the clear operation.</info>");
         $output->writeln("<info>  There is NO undo and no notifications will be sent.</info>");
         $output->writeln("<info>  All items in tracker #{$trackerId} \"{$name}\" will be deleted.</info>");
     }
     return 0;
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:25,代碼來源:TrackerClearCommand.php

示例7: wikiplugin_trackercalendar

function wikiplugin_trackercalendar($data, $params)
{
    static $id = 0;
    $headerlib = TikiLib::lib('header');
    $headerlib->add_cssfile('vendor_extra/fullcalendar-resourceviews/fullcalendar/fullcalendar.css');
    $headerlib->add_jsfile('vendor_extra/fullcalendar-resourceviews/fullcalendar/fullcalendar.min.js');
    $jit = new JitFilter($params);
    $definition = Tracker_Definition::get($jit->trackerId->int());
    $itemObject = Tracker_Item::newItem($jit->trackerId->int());
    if (!$definition) {
        return WikiParser_PluginOutput::userError(tr('Tracker not found.'));
    }
    $beginField = $definition->getFieldFromPermName($jit->begin->word());
    $endField = $definition->getFieldFromPermName($jit->end->word());
    if (!$beginField || !$endField) {
        return WikiParser_PluginOutput::userError(tr('Fields not found.'));
    }
    $views = array('month', 'agendaWeek', 'agendaDay');
    $resources = array();
    if ($resourceField = $jit->resource->word()) {
        $field = $definition->getFieldFromPermName($resourceField);
        $resources = wikiplugin_trackercalendar_get_resources($field);
        $views[] = 'resourceMonth';
        $views[] = 'resourceWeek';
        $views[] = 'resourceDay';
    }
    $smarty = TikiLib::lib('smarty');
    $smarty->assign('trackercalendar', array('id' => 'trackercalendar' . ++$id, 'trackerId' => $jit->trackerId->int(), 'begin' => $jit->begin->word(), 'end' => $jit->end->word(), 'resource' => $resourceField, 'resourceList' => $resources, 'coloring' => $jit->coloring->word(), 'beginFieldName' => 'ins_' . $beginField['fieldId'], 'endFieldName' => 'ins_' . $endField['fieldId'], 'firstDayofWeek' => 0, 'views' => implode(',', $views), 'viewyear' => (int) date('Y'), 'viewmonth' => (int) date('n'), 'viewday' => (int) date('j'), 'minHourOfDay' => 7, 'maxHourOfDay' => 20, 'addTitle' => tr('Insert'), 'canInsert' => $itemObject->canModify(), 'body' => $data));
    return $smarty->fetch('wiki-plugins/trackercalendar.tpl');
}
開發者ID:hurcane,項目名稱:tiki-azure,代碼行數:30,代碼來源:wikiplugin_trackercalendar.php

示例8: module_map_edit_features

function module_map_edit_features($mod_reference, $module_params)
{
	$targetField = null;
	$smarty = TikiLib::lib('smarty');

	$definition = Tracker_Definition::get($module_params['trackerId']);

	if ($definition) {
		foreach ($definition->getFields() as $field) {
			if ($field['type'] == 'GF') {
				$targetField = $field;
				break;
			}
		}
	}

	$hiddeninput = isset($module_params['hiddeninput']) ? $module_params['hiddeninput'] : '';
	preg_match_all('/(\w+)\(([^\)]*)\)/', $hiddeninput, $parts, PREG_SET_ORDER);
	$hidden = array();
	foreach ($parts as $p) {
		$hidden[$p[1]] = $p[2];
	}

	$smarty->assign(
					'edit_features', 
					array(
						'trackerId' => $module_params['trackerId'],
						'definition' => $definition,
						'field' => $targetField,
						'hiddenInput' => $hidden,
						'standardControls' => isset($module_params['standard']) ? intval($module_params['standard']) : 1,
					)
	);
}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:34,代碼來源:mod-func-map_edit_features.php

示例9: getLanguage

 function getLanguage($type, $object)
 {
     $lang = null;
     switch ($type) {
         case 'wiki page':
             $info = TikiLib::lib('tiki')->get_page_info($object);
             $lang = $info['lang'];
             break;
         case 'article':
             $info = TikiLib::lib('art')->get_article($object);
             $lang = $info['lang'];
             break;
         case 'trackeritem':
             $info = TikiLib::lib('trk')->get_tracker_item($object);
             $definition = Tracker_Definition::get($info['trackerId']);
             if ($field = $definition->getLanguageField()) {
                 $lang = $info[$field];
             }
             break;
         case 'forum post':
             $object = TikiLib::lib('comments')->get_comment_forum_id($object);
             // no break: drop through to forum
         // no break: drop through to forum
         case 'forum':
             $info = TikiLib::lib('comments')->get_forum($object);
             $lang = $info['forumLanguage'];
             break;
     }
     if (!$lang) {
         throw new Services_Exception(tr('Object has no language and cannot be translated'), 400);
     }
     return $lang;
 }
開發者ID:ameoba32,項目名稱:tiki,代碼行數:33,代碼來源:Utilities.php

示例10: newItem

 public static function newItem($trackerId)
 {
     $obj = new self();
     $obj->info = array();
     $obj->definition = Tracker_Definition::get($trackerId);
     $obj->initialize();
     return $obj;
 }
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:8,代碼來源:Item.php

示例11: getAllIndexableHandlers

 private function getAllIndexableHandlers()
 {
     $trackers = $this->db->table('tiki_trackers')->fetchColumn('trackerId', array());
     $handlers = array();
     foreach ($trackers as $trackerId) {
         $definition = Tracker_Definition::get($trackerId);
         $handlers = array_merge($handlers, $this->getIndexableHandlers($definition));
     }
     return $handlers;
 }
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:10,代碼來源:TrackerItemSource.php

示例12: wikiplugin_addfreetag

function wikiplugin_addfreetag($data, $params)
{
	global $user;
	$object = current_object();

	if (isset($params['object']) && false !== strpos($params['object'], ':')) {
		list($object['type'], $object['object']) = explode(':', $params['object'], 2);
	}
	if ($object['type'] == 'wiki page' && !ctype_digit($object['object'])) {
		$identifier = 'wp_addfreetag_' . str_replace(array(':',' '), array('_',''), TikiLib::lib('tiki')->get_page_id_from_name($params['object']));
	} else {
		$identifier = 'wp_addfreetag_' . str_replace(array(':',' '), array('_',''), $params['object']);
	}

	if ($object['type'] == 'trackeritem') {
		$permobject = TikiLib::lib('trk')->get_tracker_for_item($object['object']);
		$permobjecttype = 'tracker';
	} else {
		$permobject = $object['object'];
		$permobjecttype = $object['type'];
	}
	if (! TikiLib::lib('tiki')->user_has_perm_on_object($user, $permobject, $permobjecttype, 'tiki_p_freetags_tag')) {
		return '';
	}
	if (!empty($_POST[$identifier])) {
		$_POST[$identifier] = '"' . str_replace('"', '', $_POST[$identifier]) . '"';
		TikiLib::lib('freetag')->tag_object($user, $object['object'], $object['type'], $_POST[$identifier]);
		if ($object['type'] == 'trackeritem') {
			// need to update tracker field as well
			$definition = Tracker_Definition::get($permobject);
			if ($field = $definition->getFreetagField()) {
				$currenttags = TikiLib::lib('freetag')->get_tags_on_object($object['object'], 'trackeritem');
				$taglist = '';	
				foreach ($currenttags['data'] as $tag) {
					if (strstr($tag['tag'], ' ')) {
						$taglist .= '"'.$tag['tag'] . '" ';
					} else {
						$taglist .= $tag['tag'] . ' ';
					}
				}
				// taglist will have slashes
				TikiLib::lib('trk')->modify_field($object['object'], $field, stripslashes($taglist));
			}
		} 
		require_once 'lib/search/refresh-functions.php';
		refresh_index($object['type'], $object['object']);
		$url = $_SERVER['REQUEST_URI'];
		header("Location: $url");
		die;
	}

	$smarty = TikiLib::lib('smarty');
	$smarty->assign('wp_addfreetag', $identifier); 
	return $smarty->fetch('wiki-plugins/wikiplugin_addfreetag.tpl');
}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:55,代碼來源:wikiplugin_addfreetag.php

示例13: module_tracker_input

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_tracker_input($mod_reference, $module_params)
{
    global $prefs;
    $smarty = TikiLib::lib('smarty');
    $trackerId = $module_params['trackerId'];
    $itemObject = Tracker_Item::newItem($trackerId);
    $definition = Tracker_Definition::get($trackerId);
    if (!$itemObject->canModify()) {
        $smarty->assign('tracker_input', array('trackerId' => 0, 'textInput' => array(), 'hiddenInput' => array(), 'location' => null));
        return;
    }
    $textinput = isset($module_params['textinput']) ? $module_params['textinput'] : '';
    $hiddeninput = isset($module_params['hiddeninput']) ? $module_params['hiddeninput'] : '';
    $streetview = isset($module_params['streetview']) ? $module_params['streetview'] : '';
    $streetViewField = $definition->getFieldFromPermName($streetview);
    $success = isset($module_params['success']) ? $module_params['success'] : '';
    $insertmode = isset($module_params['insertmode']) ? $module_params['insertmode'] : '';
    if (!$streetview || $prefs['fgal_upload_from_source'] != 'y' || !$streetViewField) {
        $streetview = '';
    }
    $location = null;
    $locationMode = null;
    if (isset($module_params['location'])) {
        $parts = explode(':', $module_params['location'], 2);
        $location = array_shift($parts);
        $locationMode = array_shift($parts);
        if (!$locationMode) {
            $locationMode = 'marker';
        }
        $hiddeninput .= " {$location}()";
    }
    preg_match_all('/(\\w+)\\(([^\\)]+)\\)/', $textinput, $parts, PREG_SET_ORDER);
    $text = array();
    foreach ($parts as $p) {
        $text[$p[1]] = tra($p[2]);
    }
    preg_match_all('/(\\w+)\\(([^\\)]*)\\)/', $hiddeninput, $parts, PREG_SET_ORDER);
    $hidden = array();
    foreach ($parts as $p) {
        $hidden[$p[1]] = $p[2];
    }
    $galleryId = null;
    if ($streetview) {
        $galleryId = TikiLib::lib('filegal')->check_user_file_gallery($streetViewField['options_array'][0]);
    }
    $operation = null;
    $operationArgument = null;
    if (preg_match("/(\\w+)\\(([^\\)]*)\\)/", $success, $parts)) {
        $operation = $parts[1];
        $operationArgument = $parts[2];
    }
    $smarty->assign('tracker_input', array('trackerId' => $trackerId, 'textInput' => $text, 'hiddenInput' => $hidden, 'location' => $location, 'locationMode' => $locationMode, 'streetview' => $streetview, 'galleryId' => $galleryId, 'submit' => isset($module_params['submit']) ? $module_params['submit'] : tr('Create'), 'success' => array('operation' => $operation, 'argument' => $operationArgument), 'insertMode' => $insertmode));
}
開發者ID:hurcane,項目名稱:tiki-azure,代碼行數:57,代碼來源:mod-func-tracker_input.php

示例14: execute

 function execute(JitFilter $data)
 {
     $object_id = $data->object_id->int();
     $field = $data->field->word();
     $value = $data->value->text();
     $trklib = TikiLib::lib('trk');
     $info = $trklib->get_item_info($object_id);
     $definition = Tracker_Definition::get($info['trackerId']);
     $utilities = new Services_Tracker_Utilities();
     $utilities->updateItem($definition, array('itemId' => $object_id, 'status' => $info['status'], 'fields' => array($field => $value)));
     return true;
 }
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:12,代碼來源:TrackerItemModify.php

示例15: action_list

 function action_list($input)
 {
     global $prefs;
     $unifiedsearchlib = TikiLib::lib('unifiedsearch');
     $index = $unifiedsearchlib->getIndex();
     $dataSource = $unifiedsearchlib->getDataSource();
     $start = 'tracker_field_' . $input->beginField->word();
     $end = 'tracker_field_' . $input->endField->word();
     if ($resource = $input->resourceField->word()) {
         $resource = 'tracker_field_' . $resource;
     }
     if ($coloring = $input->coloringField->word()) {
         $coloring = 'tracker_field_' . $coloring;
     }
     $query = $unifiedsearchlib->buildQuery(array());
     $query->filterRange($input->start->int(), $input->end->int(), array($start, $end));
     $query->setRange(0, $prefs['unified_lucene_max_result']);
     if ($body = $input->filters->none()) {
         $builder = new Search_Query_WikiBuilder($query);
         $builder->apply(WikiParser_PluginMatcher::match($body));
     }
     $result = $query->search($index);
     $result = $dataSource->getInformation($result, array('title', $start, $end));
     $response = array();
     $fields = array();
     if ($definition = Tracker_Definition::get($input->trackerId->int())) {
         foreach ($definition->getPopupFields() as $fieldId) {
             if ($field = $definition->getField($fieldId)) {
                 $fields[] = $field;
             }
         }
     }
     $smarty = TikiLib::lib('smarty');
     $smarty->loadPlugin('smarty_modifier_sefurl');
     $trklib = TikiLib::lib('trk');
     foreach ($result as $row) {
         $item = Tracker_Item::fromId($row['object_id']);
         $description = '';
         foreach ($fields as $field) {
             if ($item->canViewField($field['fieldId'])) {
                 $val = trim($trklib->field_render_value(array('field' => $field, 'item' => $item->getData(), 'process' => 'y')));
                 if ($val) {
                     if (count($fields) > 1) {
                         $description .= "<h5>{$field['name']}</h5>";
                     }
                     $description .= $val;
                 }
             }
         }
         $response[] = array('id' => $row['object_id'], 'trackerId' => isset($row['tracker_id']) ? $row['tracker_id'] : null, 'title' => $row['title'], 'description' => $description, 'url' => smarty_modifier_sefurl($row['object_id'], $row['object_type']), 'allDay' => false, 'start' => $this->getTimestamp($row[$start]), 'end' => $this->getTimestamp($row[$end]), 'editable' => $item->canModify(), 'color' => $this->getColor(isset($row[$coloring]) ? $row[$coloring] : ''), 'textColor' => '#000', 'resource' => $resource && isset($row[$resource]) ? strtolower($row[$resource]) : '');
     }
     return $response;
 }
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:53,代碼來源:CalendarController.php


注:本文中的Tracker_Definition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。