. * * ------------------------------------------------------------------------ * * This file is used to manage the deploy task. * * ------------------------------------------------------------------------ * * @package FusionInventory * @author Alexandre Delaunay * @author David Durieux * @copyright Copyright (c) 2010-2016 FusionInventory team * @license AGPL License 3.0 or (at your option) any later version * http://www.gnu.org/licenses/agpl-3.0-standalone.html * @link http://www.fusioninventory.org/ * @link https://github.com/fusioninventory/fusioninventory-for-glpi * */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access directly to this file"); } include_once(PLUGIN_FUSIONINVENTORY_DIR . "/inc/taskjobview.class.php"); include_once(PLUGIN_FUSIONINVENTORY_DIR . "/inc/taskview.class.php"); include_once(PLUGIN_FUSIONINVENTORY_DIR . "/inc/task.class.php"); /** * Manage the deploy task. */ class PluginFusioninventoryDeployTask extends PluginFusioninventoryTask { /** * Get name of this type by language of the user connected * * @param integer $nb number of elements * @return string name of this type */ static function getTypeName($nb = 0) { if ($nb > 1) { return PluginFusioninventoryDeployGroup::getTypeName(); } return __('Task', 'fusioninventory'); } /** * Is this use can create a deploy task * * @return boolean */ static function canCreate() { return true; } /** * Is this use can view a deploy task * * @return boolean */ static function canView() { return true; } /** * Define tabs to display on form page * * @param array $options * @return array containing the tabs name */ function defineTabs($options = []) { $ong = []; if ($this->fields['id'] > 0) { $this->addStandardTab(__CLASS__, $ong, $options); } return $ong; } /** * Get the tab name used for item * * @param object $item the item object * @param integer $withtemplate 1 if is a template form * @return string name of the tab */ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { switch (get_class($item)) { case __CLASS__: return __('Order list', 'fusioninventory'); } return ''; } /** * Display the content of the tab * * @param object $item * @param integer $tabnum number of the tab to display * @param integer $withtemplate 1 if is a template form * @return boolean */ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { switch (get_class($item)) { case __CLASS__: $obj = new self; $obj->showActions($_POST["id"]); return true; } return false; } /** * Show list of deploy tasks */ function showList() { self::title(); Search::show('PluginFusioninventoryDeployTask'); } /** * Display the title of the page * * @global array $CFG_GLPI */ function title() { global $CFG_GLPI; $buttons = []; $title = __('Task', 'fusioninventory'); if ($this->canCreate()) { $buttons["task.form.php?new=1"] = __('Add task', 'fusioninventory'); $title = ""; } Html::displayTitle($CFG_GLPI["root_doc"] . "/plugins/fusinvdeploy/pics/task.png", $title, $title, $buttons); } /** * Show actions of the deploy task * * @param integer $id */ function showActions($id) { //load extjs plugins library echo ""; $this->getFromDB($id); if ($this->getField('is_active') == 1) { echo "