$LANG['plugin_example']['test']." (class)", 'parameter' => $LANG['plugin_example']['test']); } return array(); } /** * Execute 1 task manage by the plugin * * @param $task Object of CronTask class for log / stat * * @return interger * >0 : done * <0 : to be run again (not finished) * 0 : nothing to do */ static function cronSample($task) { $task->log("Example log message from class"); $task->setVolume(mt_rand(0,$task->fields['param'])); return 1; } // Hook done on before add item case static function pre_item_add_example($item) { addMessageAfterRedirect("Pre Add Computer Hook",true); } // Hook done on add item case static function item_add_example($item) { addMessageAfterRedirect("Add Computer Hook, ID=".$item->getField('id'),true); return true; } function getTabNameForItem(CommonGLPI $item) { global $LANG; Toolbox::logDebug('getTabNameForItem', $item); if ($item->getID()) { switch ($item->getType()) { case 'Phone' : if ($_SESSION['glpishow_count_on_tabs']) { return self::createTabEntry('Example', countElementsInTable($this->getTable())); } return 'Example'; } } return ''; } static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { if ($item->getType()=='Phone') { echo "Plugin Example on Phone"; } return true; } } ?>