static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'Computer') {
         if (self::canView()) {
             // Show list filtered on computer, sorted on day descending ...
             $_GET = array('field' => array(22), 'searchtype' => array('equals'), 'contains' => array($item->getID()), 'itemtype' => 'PluginMonitoringServiceevent', 'start' => 0, 'sort' => 3, 'order' => 'DESC');
             Search::manageGetValues(self::getTypeName());
             Search::showList(self::getTypeName(), $_GET);
             return true;
         }
     }
     return true;
 }
 public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     global $CFG_GLPI;
     echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
      <h3 class="tab_bg_2" style="padding: 5px">
        <a href="' . Toolbox::getItemTypeFormURL(__CLASS__) . '" class="submit">
             <img src="' . $CFG_GLPI['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
             ' . __('Add a form category', 'formcreator') . '
         </a>
      </h3>
   </div>';
     $params['sort'] = !empty($_POST['sort']) ? (int) $_POST['sort'] : 0;
     $params['order'] = !empty($_POST['order']) && in_array($_POST['order'], array('ASC', 'DESC')) ? $_POST['order'] : 'ASC';
     $params['start'] = !empty($_POST['start']) ? (int) $_POST['start'] : 0;
     Search::manageGetValues(__CLASS__);
     Search::showList(__CLASS__, $params);
 }
Example #3
0
 public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     $header = new self();
     $found = $header->find('entities_id = ' . $_SESSION['glpiactive_entity']);
     if (count($found) > 0) {
         echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
         <h3 class="tab_bg_2" style="padding: 5px">
             <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add_off.png" alt="+" align="absmiddle" />
             ' . __('Add an header', 'formcreator') . '<br /><br />
            <em><i><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/warning.png" alt="/!\\" align="absmiddle" height="16" />&nbsp;
            ' . __('An header already exists for this entity! You can have only one header per entity.', 'formcreator') . '</i></em>
         </h3>
      </div>';
     } else {
         $table = getTableForItemType('PluginFormcreatorHeader');
         $where = getEntitiesRestrictRequest("", $table, "", "", true, false);
         $found = $header->find($where);
         if (count($found) > 0) {
             echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
            <h3 class="tab_bg_2" style="padding: 5px">
           <a href="' . Toolbox::getItemTypeFormURL(__CLASS__) . '" class="submit">
                <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
                ' . __('Add an header', 'formcreator') . '
            </a><br /><br />
               <em><i><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/warning.png" alt="/!\\" align="absmiddle" height="16" />&nbsp;
               ' . __('An header exists for a parent entity! Another header will overwrite the previous one.', 'formcreator') . '</i></em>
            </h3>
         </div>';
         } else {
             echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
            <h3 class="tab_bg_2" style="padding: 5px">
              <a href="' . Toolbox::getItemTypeFormURL(__CLASS__) . '" class="submit">
                   <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
                   ' . __('Add an header', 'formcreator') . '
               </a>
            </h3>
         </div>';
         }
     }
     $params['sort'] = !empty($_POST['sort']) ? (int) $_POST['sort'] : 0;
     $params['order'] = !empty($_POST['order']) && in_array($_POST['order'], array('ASC', 'DESC')) ? $_POST['order'] : 'ASC';
     $params['start'] = !empty($_POST['start']) ? (int) $_POST['start'] : 0;
     Search::manageGetValues(__CLASS__);
     //Search::showGenericSearch(__CLASS__, $_GET);
     Search::showList(__CLASS__, $params);
 }
Example #4
0
                switch ($params["type"]) {
                    case "comp_champ":
                        $val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
                        Stat::show($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
                        break;
                    case "device":
                        $val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
                        Stat::show($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
                        break;
                    default:
                        $val2 = isset($params['value2']) ? $params['value2'] : 0;
                        $val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["type"], $val2);
                        Stat::show($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $val2);
                }
            } else {
                if (isset($_GET["type"]) && $_GET["type"] == "hardwares") {
                    Stat::showItems("", $_GET["date1"], $_GET["date2"], $_GET['start']);
                }
            }
            break;
        default:
            // Plugin case
            if ($plug = isPluginItemType($_GET["item_type"])) {
                if (Plugin::doOneHook($plug['plugin'], 'dynamicReport', $_GET)) {
                    exit;
                }
            }
            Search::manageGetValues($_GET["item_type"]);
            Search::showList($_GET["item_type"], $_GET);
    }
}
 /**
  * Display quick list logs
  *
  * @param $tasks_id integer id of task
  *
  * @return nothing
  */
 static function quickListLogs($tasks_id)
 {
     global $DB;
     $query = "SELECT * FROM `glpi_plugin_fusioninventory_taskjobstates`\n         LEFT JOIN `glpi_plugin_fusioninventory_taskjobs`\n            ON `plugin_fusioninventory_taskjobs_id` = `glpi_plugin_fusioninventory_taskjobs`.`id`\n         WHERE `plugin_fusioninventory_tasks_id`='" . $tasks_id . "'\n         ORDER BY uniqid DESC\n         LIMIT 1";
     $result = $DB->query($query);
     $uniqid = 0;
     $action = '';
     while ($data = $DB->fetch_array($result)) {
         $uniqid = $data['uniqid'];
         $action = $data['action'];
     }
     if ($uniqid == '0') {
         if ($action == '') {
             echo "<center><strong>No agent found for this task</strong></center>";
         }
     } else {
         $params = array();
         $params['field'][0] = '6';
         $params['searchtype'][0] = 'contains';
         $params['contains'][0] = $uniqid;
         $params['itemtype'] = 'PluginFusioninventoryTaskjoblog';
         $params['start'] = '0';
         Search::manageGetValues('PluginFusioninventoryTaskjoblog');
         Search::showList('PluginFusioninventoryTaskjoblog', $params);
     }
 }
Example #6
0
You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
//show list of users linked with a resource
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
    Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
$directory = new PluginResourcesDirectory();
if ($directory->canView() || Session::haveRight("config", "w")) {
    if (empty($_GET["sort"])) {
        $_GET["sort"] = "34";
    }
    if (empty($_GET["order"])) {
        $_GET["order"] = "ASC";
    }
    Search::manageGetValues("PluginResourcesDirectory");
    $directory->showGenericSearch($_GET);
    $directory->showMinimalList($_GET);
} else {
    Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::footer();
} else {
    Html::helpFooter();
}
 /**
  * Display content of tab
  *
  * @param CommonGLPI $item
  * @param integer $tabnum
  * @param interger $withtemplate
  *
  * @return boolean true
  */
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     // Toolbox::logInFile("pm-downtime", "Downtime, displayTabContentForItem ($withtemplate), item concerned : ".$item->getTypeName()."/".$item->getID()."\n");
     if ($item->getType() == 'Ticket') {
         if (self::canView()) {
             // Show list filtered on item, sorted on day descending ...
             Search::manageGetValues(self::getTypeName());
             Search::showList(self::getTypeName(), array('field' => array(12), 'searchtype' => array('equals'), 'contains' => array($item->getID()), 'sort' => 4, 'order' => 'DESC'));
             return true;
         }
     }
     if ($item->getType() == 'Computer') {
         if (self::canView()) {
             // Show list filtered on item, sorted on day descending ...
             Search::manageGetValues(self::getTypeName());
             Search::showList(self::getTypeName(), array('field' => array(2), 'searchtype' => array('equals'), 'contains' => array($item->getID()), 'sort' => 4, 'order' => 'DESC'));
             return true;
         }
     }
     return true;
 }
Example #8
0
} else {
    Html::helpHeader(PluginIdeaboxIdeabox::getTypeName(2));
}
$idea = new PluginIdeaboxIdeabox();
if ($idea->canView() || Session::haveRight("config", "w")) {
    if ($_SESSION['glpiactiveprofile']['interface'] != 'central') {
        if ($idea->canCreate()) {
            echo "<div align='center'><table class='tab_cadre_fixe' cellpadding='5'>";
            echo "<tr><th>" . __('Menu', 'ideabox') . "</th></tr>";
            echo "<tr class='tab_bg_1'><td class='center'>";
            echo "<a href=\"./ideabox.form.php\">";
            _e('Submit an idea', 'ideabox');
            echo "</a>";
            echo "</td></tr>";
            echo " </table></div>";
        }
        Search::manageGetValues("PluginIdeaboxIdeabox");
        $_GET["field"] = array(0 => "2");
        $_GET["contains"] = array(0 => $_SESSION["glpiname"]);
        Search::showList("PluginIdeaboxIdeabox", $_GET);
    } else {
        Search::show("PluginIdeaboxIdeabox");
    }
} else {
    Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::footer();
} else {
    Html::helpFooter();
}
Example #9
0
This file is part of Resources.

Resources is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Resources is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources", "employment");
$employment = new PluginResourcesEmployment();
if ($employment->canView() || Session::haveRight("config", "w")) {
    Search::manageGetValues("PluginResourcesEmployment");
    if (isset($_GET["plugin_resources_resources_id"]) && !empty($_GET["plugin_resources_resources_id"])) {
        $_GET["field"] = array(0 => "13");
        $_GET["contains"] = array(0 => $_GET["plugin_resources_resources_id"]);
    }
    Search::showGenericSearch("PluginResourcesEmployment", $_GET);
    Search::showList("PluginResourcesEmployment", $_GET);
} else {
    Html::displayRightError();
}
Html::footer();
Example #10
0
Resources is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    //from central
    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
    //from helpdesk
    Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
$holiday = new PluginResourcesResourceHoliday();
if ($holiday->canView() || Session::haveRight("config", "w")) {
    Search::manageGetValues("PluginResourcesResourceHoliday");
    $holiday->showGenericSearch($_GET);
    $holiday->showMinimalList($_GET);
} else {
    Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::footer();
} else {
    Html::helpFooter();
}
Example #11
0
Resources is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Resources is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
$task = new PluginResourcesTask();
if ($task->canView() || Session::haveRight("config", "w")) {
    Search::manageGetValues("PluginResourcesTask");
    //if $_GET["plugin_resources_resources_id"] exist this show list of tasks from a resource
    //else show all resources
    if (isset($_GET["plugin_resources_resources_id"]) && !empty($_GET["plugin_resources_resources_id"])) {
        $_GET["field"] = array(0 => "13");
        $_GET["contains"] = array(0 => $_GET["plugin_resources_resources_id"]);
    }
    Search::showGenericSearch("PluginResourcesTask", $_GET);
    Search::showList("PluginResourcesTask", $_GET);
} else {
    Html::displayRightError();
}
Html::footer();
Example #12
0
-------------------------------------------------------------------------

LICENSE

This file is part of Resources.

Resources is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Resources is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources", "checklist");
$checklistconfig = new PluginResourcesChecklistconfig();
if ($checklistconfig->canView() || Session::haveRight("config", "w")) {
    Search::manageGetValues("PluginResourcesChecklistconfig");
    Search::showGenericSearch("PluginResourcesChecklistconfig", $_GET);
    Search::showList("PluginResourcesChecklistconfig", $_GET);
} else {
    Html::displayRightError();
}
Html::footer();
 function prepareRun($taskjobs_id)
 {
     global $DB;
     $task = new PluginFusioninventoryTask();
     $job = new PluginFusioninventoryTaskjob();
     $joblog = new PluginFusioninventoryTaskjoblog();
     $jobstate = new PluginFusioninventoryTaskjobstate();
     $agent = new PluginFusioninventoryAgent();
     $uniqid = uniqid();
     $job->getFromDB($taskjobs_id);
     $task->getFromDB($job->fields['plugin_fusioninventory_tasks_id']);
     $communication = $task->fields['communication'];
     $actions = importArrayFromDB($job->fields['action']);
     $definitions = importArrayFromDB($job->fields['definition']);
     $taskvalid = 0;
     $computers = array();
     foreach ($actions as $action) {
         $itemtype = key($action);
         $items_id = current($action);
         switch ($itemtype) {
             case 'Computer':
                 $computers[] = $items_id;
                 break;
             case 'Group':
                 $computer_object = new Computer();
                 //find computers by user associated with this group
                 $group_users = new Group_User();
                 $group = new Group();
                 $group->getFromDB($items_id);
                 $members = array();
                 $computers_a_1 = array();
                 $computers_a_2 = array();
                 //array_keys($group_users->find("groups_id = '$items_id'"));
                 $members = $group_users->getGroupUsers($items_id);
                 foreach ($members as $member) {
                     $computers = $computer_object->find("users_id = '{$member['id']}'");
                     foreach ($computers as $computer) {
                         $computers_a_1[] = $computer['id'];
                     }
                 }
                 //find computers directly associated with this group
                 $computers = $computer_object->find("groups_id = '{$items_id}'");
                 foreach ($computers as $computer) {
                     $computers_a_2[] = $computer['id'];
                 }
                 //merge two previous array and deduplicate entries
                 $computers = array_unique(array_merge($computers_a_1, $computers_a_2));
                 break;
             case 'PluginFusioninventoryDeployGroup':
                 $group = new PluginFusioninventoryDeployGroup();
                 $group->getFromDB($items_id);
                 switch ($group->getField('type')) {
                     case 'STATIC':
                         $query = "SELECT items_id\n                     FROM glpi_plugin_fusioninventory_deploygroups_staticdatas\n                     WHERE groups_id = '{$items_id}'\n                     AND itemtype = 'Computer'";
                         $res = $DB->query($query);
                         while ($row = $DB->fetch_assoc($res)) {
                             $computers[] = $row['items_id'];
                         }
                         break;
                     case 'DYNAMIC':
                         $query = "SELECT fields_array\n                     FROM glpi_plugin_fusioninventory_deploygroups_dynamicdatas\n                     WHERE groups_id = '{$items_id}'\n                     LIMIT 1";
                         $res = $DB->query($query);
                         $row = $DB->fetch_assoc($res);
                         if (isset($_GET)) {
                             $get_tmp = $_GET;
                         }
                         if (isset($_SESSION["glpisearchcount"]['Computer'])) {
                             unset($_SESSION["glpisearchcount"]['Computer']);
                         }
                         if (isset($_SESSION["glpisearchcount2"]['Computer'])) {
                             unset($_SESSION["glpisearchcount2"]['Computer']);
                         }
                         $_GET = importArrayFromDB($row['fields_array']);
                         $_GET["glpisearchcount"] = count($_GET['field']);
                         if (isset($_GET['field2'])) {
                             $_GET["glpisearchcount2"] = count($_GET['field2']);
                         }
                         $pfSearch = new PluginFusioninventorySearch();
                         Search::manageGetValues('Computer');
                         $glpilist_limit = $_SESSION['glpilist_limit'];
                         $_SESSION['glpilist_limit'] = 999999999;
                         $result = $pfSearch->constructSQL('Computer', $_GET);
                         $_SESSION['glpilist_limit'] = $glpilist_limit;
                         while ($data = $DB->fetch_array($result)) {
                             $computers[] = $data['id'];
                         }
                         if (count($get_tmp) > 0) {
                             $_GET = $get_tmp;
                         }
                         break;
                 }
                 break;
         }
     }
     $c_input = array();
     $c_input['plugin_fusioninventory_taskjobs_id'] = $taskjobs_id;
     $c_input['state'] = 0;
     $c_input['plugin_fusioninventory_agents_id'] = 0;
     $c_input['execution_id'] = $task->fields['execution_id'];
     $pfCollect = new PluginFusioninventoryCollect();
     foreach ($computers as $computer_id) {
         //get agent if for this computer
         $agents_id = $agent->getAgentWithComputerid($computer_id);
         if ($agents_id === FALSE) {
             $jobstates_id = $jobstate->add($c_input);
             $jobstate->changeStatusFinish($jobstates_id, 0, '', 1, "No agent found for [[Computer::" . $computer_id . "]]", 0, 0);
         } else {
             foreach ($definitions as $definition) {
                 $pfCollect->getFromDB($definition['PluginFusioninventoryCollect']);
                 switch ($pfCollect->fields['type']) {
                     case 'registry':
                         // get all registry
                         $pfCollect_Registry = new PluginFusioninventoryCollect_Registry();
                         $a_registries = $pfCollect_Registry->find("`plugin_fusioninventory_collects_id`='" . $pfCollect->fields['id'] . "'");
                         foreach ($a_registries as $data_r) {
                             $uniqid = uniqid();
                             $c_input['state'] = 0;
                             $c_input['itemtype'] = 'PluginFusioninventoryCollect_Registry';
                             $c_input['items_id'] = $data_r['id'];
                             $c_input['date'] = date("Y-m-d H:i:s");
                             $c_input['uniqid'] = $uniqid;
                             $c_input['plugin_fusioninventory_agents_id'] = $agents_id;
                             # Push the agent, in the stack of agent to awake
                             if ($communication == "push") {
                                 $_SESSION['glpi_plugin_fusioninventory']['agents'][$agents_id] = 1;
                             }
                             $jobstates_id = $jobstate->add($c_input);
                             //Add log of taskjob
                             $c_input['plugin_fusioninventory_taskjobstates_id'] = $jobstates_id;
                             $c_input['state'] = PluginFusioninventoryTaskjoblog::TASK_PREPARED;
                             $taskvalid++;
                             $joblog->add($c_input);
                         }
                         break;
                     case 'wmi':
                         // get all wmi
                         $pfCollect_Wmi = new PluginFusioninventoryCollect_Wmi();
                         $a_wmies = $pfCollect_Wmi->find("`plugin_fusioninventory_collects_id`='" . $pfCollect->fields['id'] . "'");
                         foreach ($a_wmies as $data_r) {
                             $uniqid = uniqid();
                             $c_input['state'] = 0;
                             $c_input['itemtype'] = 'PluginFusioninventoryCollect_Wmi';
                             $c_input['items_id'] = $data_r['id'];
                             $c_input['date'] = date("Y-m-d H:i:s");
                             $c_input['uniqid'] = $uniqid;
                             $c_input['plugin_fusioninventory_agents_id'] = $agents_id;
                             # Push the agent, in the stack of agent to awake
                             if ($communication == "push") {
                                 $_SESSION['glpi_plugin_fusioninventory']['agents'][$agents_id] = 1;
                             }
                             $jobstates_id = $jobstate->add($c_input);
                             //Add log of taskjob
                             $c_input['plugin_fusioninventory_taskjobstates_id'] = $jobstates_id;
                             $c_input['state'] = PluginFusioninventoryTaskjoblog::TASK_PREPARED;
                             $taskvalid++;
                             $joblog->add($c_input);
                         }
                         break;
                     case 'file':
                         // find files
                         $pfCollect_File = new PluginFusioninventoryCollect_File();
                         $a_files = $pfCollect_File->find("`plugin_fusioninventory_collects_id`='" . $pfCollect->fields['id'] . "'");
                         foreach ($a_files as $data_r) {
                             $uniqid = uniqid();
                             $c_input['state'] = 0;
                             $c_input['itemtype'] = 'PluginFusioninventoryCollect_File';
                             $c_input['items_id'] = $data_r['id'];
                             $c_input['date'] = date("Y-m-d H:i:s");
                             $c_input['uniqid'] = $uniqid;
                             $c_input['plugin_fusioninventory_agents_id'] = $agents_id;
                             # Push the agent, in the stack of agent to awake
                             if ($communication == "push") {
                                 $_SESSION['glpi_plugin_fusioninventory']['agents'][$agents_id] = 1;
                             }
                             $jobstates_id = $jobstate->add($c_input);
                             //Add log of taskjob
                             $c_input['plugin_fusioninventory_taskjobstates_id'] = $jobstates_id;
                             $c_input['state'] = PluginFusioninventoryTaskjoblog::TASK_PREPARED;
                             $taskvalid++;
                             $joblog->add($c_input);
                         }
                         break;
                 }
             }
         }
     }
     if ($taskvalid > 0) {
         $job->fields['status'] = 1;
         $job->update($job->fields);
     } else {
         $job->reinitializeTaskjobs($job->fields['plugin_fusioninventory_tasks_id']);
     }
 }
   static function getItemsDynamicly($parm) {
      global $DB;

      $pmDisplayview_rule        = new PluginMonitoringDisplayview_rule();
      $pmDisplayview_item        = new PluginMonitoringDisplayview_item();
      $pmDisplayview             = new PluginMonitoringDisplayview();
      $pmSearch                  = new PluginMonitoringSearch();
      $pmService                 = new PluginMonitoringService();

      $devices_present = array();
      if ($pmDisplayview_rule->getFromDB($parm->fields['id'])) {
         if ($pmDisplayview->getFromDB($pmDisplayview_rule->fields['plugin_monitoring_displayviews_id'])) {
            // Load right entity

               $default_entity = 0;
               if (isset($_SESSION['glpiactive_entity'])) {
                  $default_entity = $_SESSION['glpiactive_entity'];
               }
               $entities_isrecursive = 0;
               if (isset($_SESSION['glpiactiveentities'])
                       AND count($_SESSION['glpiactiveentities']) > 1) {
                  $entities_isrecursive = 1;
               }
               Session::changeActiveEntities($pmDisplayview->fields['entities_id'],
                                             $pmDisplayview->fields['is_recursive']);


            $get_tmp = '';
            $itemtype = $pmDisplayview_rule->fields['itemtype'];
            if (isset($_GET)) {
                $get_tmp = $_GET;
            }
            if (isset($_SESSION["glpisearchcount"][$pmDisplayview_rule->fields['itemtype']])) {
               unset($_SESSION["glpisearchcount"][$pmDisplayview_rule->fields['itemtype']]);
            }
            if (isset($_SESSION["glpisearchcount2"][$pmDisplayview_rule->fields['itemtype']])) {
               unset($_SESSION["glpisearchcount2"][$pmDisplayview_rule->fields['itemtype']]);
            }

            $_GET = importArrayFromDB($pmDisplayview_rule->fields['condition']);

            $_GET["glpisearchcount"] = count($_GET['field']);
            if (isset($_GET['field2'])) {
               $_GET["glpisearchcount2"] = count($_GET['field2']);
            }

            Search::manageGetValues($pmDisplayview_rule->fields['itemtype']);

            $queryd = "SELECT * FROM `glpi_plugin_monitoring_displayviews_items`
               WHERE `plugin_monitoring_displayviews_id`='".$pmDisplayview_rule->fields["plugin_monitoring_displayviews_id"]."'
                  AND `itemtype`='".$pmDisplayview_rule->fields['type']."'
                  AND `extra_infos`='".$pmDisplayview_rule->fields['itemtype']."'";
            $result = $DB->query($queryd);
            while ($data=$DB->fetch_array($result)) {
               $devices_present[$data['items_id']] = $data['id'];
            }

            $glpilist_limit = $_SESSION['glpilist_limit'];
            $_SESSION['glpilist_limit'] = 500000;
            $result = $pmSearch->constructSQL($itemtype,
                                           $_GET);
            $_SESSION['glpilist_limit'] = $glpilist_limit;

            while ($data=$DB->fetch_array($result)) {
               if (!isset($devices_present[$data['id']])) {
                  // Verify this device has one or more resources
                  $query_h = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`"
                          . " LEFT JOIN `glpi_plugin_monitoring_services`"
                          . "    ON `plugin_monitoring_componentscatalogs_hosts_id`="
                          . " `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`"
                          . " WHERE `items_id`='".$data['id']."'"
                          . "    AND `itemtype`='".$pmDisplayview_rule->fields['itemtype']."'"
                          . "    AND `glpi_plugin_monitoring_services`.`id` IS NOT NULL";
                  $result_h = $DB->query($query_h);
                  if ($DB->numrows($result_h) > 0) {

                     $input = array();
                     $input['plugin_monitoring_displayviews_id'] = $pmDisplayview_rule->fields["plugin_monitoring_displayviews_id"];
                     $input['x'] = '1';
                     $input['y'] = '1';
                     $input['items_id'] = $data['id'];
                     $input['itemtype'] = $pmDisplayview_rule->fields['type'];
                     $input['extra_infos'] = $pmDisplayview_rule->fields['itemtype'];

                     $pmDisplayview_item->add($input);
                  }
               } else {
                  // Verify this device has one or more resources
                  $query_h = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`"
                          . " LEFT JOIN `glpi_plugin_monitoring_services`"
                          . "    ON `plugin_monitoring_componentscatalogs_hosts_id`="
                          . " `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`"
                          . " WHERE `items_id`='".$data['id']."'"
                          . "    AND `itemtype`='".$pmDisplayview_rule->fields['itemtype']."'"
                          . "    AND `glpi_plugin_monitoring_services`.`id` IS NOT NULL";
                  $result_h = $DB->query($query_h);
                  if ($DB->numrows($result_h) > 0) {
                     unset($devices_present[$data['id']]);
                  }
               }
            }

            // Reload current entity
               Session::changeActiveEntities($default_entity,
                                    $entities_isrecursive);
         } else {
            $pmDisplayview->delete(array('id' => $pmDisplayview_rule->fields['plugin_monitoring_displayviews_id']));
         }
      }
      foreach ($devices_present as $id) {
         $pmDisplayview_item->delete(array('id'=>$id));
      }
      return true;
   }
 function prepareRun($taskjobs_id)
 {
     global $DB;
     $pfTask = new PluginFusioninventoryTask();
     $pfTaskjob = new PluginFusioninventoryTaskjob();
     $pfTaskjobstate = new PluginFusioninventoryTaskjobstate();
     $pfTaskjoblog = new PluginFusioninventoryTaskjoblog();
     $pfAgent = new PluginFusioninventoryAgent();
     $uniqid = uniqid();
     $pfTaskjob->getFromDB($taskjobs_id);
     $pfTask->getFromDB($pfTaskjob->fields['plugin_fusioninventory_tasks_id']);
     $communication = $pfTask->fields['communication'];
     $a_definitions = importArrayFromDB($pfTaskjob->fields['definition']);
     $a_computers_to_wake = array();
     foreach ($a_definitions as $definition) {
         $itemtype = key($definition);
         $items_id = current($definition);
         switch ($itemtype) {
             case 'Computer':
                 $a_computers_to_wake[] = $items_id;
                 break;
             case 'PluginFusioninventoryDeployGroup':
                 $group = new PluginFusioninventoryDeployGroup();
                 $group->getFromDB($items_id);
                 switch ($group->getField('type')) {
                     case 'STATIC':
                         $query = "SELECT items_id\n                     FROM glpi_plugin_fusioninventory_deploygroups_staticdatas\n                     WHERE groups_id = '{$items_id}'\n                     AND itemtype = 'Computer'";
                         $res = $DB->query($query);
                         while ($row = $DB->fetch_assoc($res)) {
                             $a_computers_to_wake[] = $row['items_id'];
                         }
                         break;
                     case 'DYNAMIC':
                         $query = "SELECT fields_array\n                     FROM glpi_plugin_fusioninventory_deploygroups_dynamicdatas\n                     WHERE groups_id = '{$items_id}'\n                     LIMIT 1";
                         $res = $DB->query($query);
                         $row = $DB->fetch_assoc($res);
                         if (isset($_GET)) {
                             $get_tmp = $_GET;
                         }
                         if (isset($_SESSION["glpisearchcount"]['Computer'])) {
                             unset($_SESSION["glpisearchcount"]['Computer']);
                         }
                         if (isset($_SESSION["glpisearchcount2"]['Computer'])) {
                             unset($_SESSION["glpisearchcount2"]['Computer']);
                         }
                         $_GET = importArrayFromDB($row['fields_array']);
                         $_GET["glpisearchcount"] = count($_GET['field']);
                         if (isset($_GET['field2'])) {
                             $_GET["glpisearchcount2"] = count($_GET['field2']);
                         }
                         $pfSearch = new PluginFusioninventorySearch();
                         Search::manageGetValues('Computer');
                         $glpilist_limit = $_SESSION['glpilist_limit'];
                         $_SESSION['glpilist_limit'] = 999999999;
                         $result = $pfSearch->constructSQL('Computer', $_GET);
                         $_SESSION['glpilist_limit'] = $glpilist_limit;
                         while ($data = $DB->fetch_array($result)) {
                             $a_computers_to_wake[] = $data['id'];
                         }
                         if (count($get_tmp) > 0) {
                             $_GET = $get_tmp;
                         }
                         break;
                 }
         }
     }
     $a_actions = importArrayFromDB($pfTaskjob->fields['action']);
     $a_agentList = array();
     if (!strstr($pfTaskjob->fields['action'], '".1"') and !strstr($pfTaskjob->fields['action'], '".2"')) {
         foreach ($a_actions as $a_action) {
             if (!in_array('.1', $a_action) && !in_array('.2', $a_action)) {
                 $agent_id = current($a_action);
                 if ($pfAgent->getFromDB($agent_id)) {
                     if ($communication == 'pull') {
                         $a_agentList[] = $agent_id;
                     } else {
                         if ($pfTaskjob->isAgentAlive('1', $agent_id)) {
                             $a_agentList[] = $agent_id;
                         }
                     }
                 }
             }
         }
     } else {
         if (strstr($pfTaskjob->fields['action'], '".1"')) {
             $a_agentList = $this->getAgentsSubnet(count($a_computers_to_wake), $communication);
         } else {
             if (in_array('.2', $a_actions)) {
                 $subnet = '';
                 foreach ($a_computers_to_wake as $items_id) {
                     $sql = "SELECT * FROM `glpi_networkports`\n               WHERE `items_id`='" . $items_id . "'\n                  AND `itemtype`='Computer'\n                  AND `mac`!='' ";
                     $result = $DB->query($sql);
                     if ($result) {
                         while ($data = $DB->fetch_array($result)) {
                             $subnet = $data['subnet'];
                         }
                     }
                 }
                 if ($subnet != '') {
                     $a_agentList = $this->getAgentsSubnet(count($a_computers_to_wake), $communication, $subnet);
                 }
             }
         }
     }
     if (count($a_agentList) == '0') {
         $a_input = array();
         $a_input['plugin_fusioninventory_taskjobs_id'] = $taskjobs_id;
         $a_input['state'] = 1;
         $a_input['plugin_fusioninventory_agents_id'] = 0;
         $a_input['itemtype'] = 'Computer';
         $a_input['items_id'] = 0;
         $a_input['uniqid'] = $uniqid;
         $Taskjobstates_id = $pfTaskjobstate->add($a_input);
         //Add log of taskjob
         $a_input['plugin_fusioninventory_taskjobstates_id'] = $Taskjobstates_id;
         $a_input['state'] = 7;
         $a_input['date'] = date("Y-m-d H:i:s");
         $pfTaskjoblog->add($a_input);
         $pfTaskjobstate->changeStatusFinish($Taskjobstates_id, 0, 'Computer', 1, "Unable to find agent to run this job");
     } else {
         $nb_computers = ceil(count($a_computers_to_wake) / count($a_agentList));
         $a_input = array();
         $a_input['plugin_fusioninventory_taskjobs_id'] = $taskjobs_id;
         $a_input['state'] = 0;
         $a_input['itemtype'] = 'Computer';
         $a_input['uniqid'] = $uniqid;
         while (count($a_computers_to_wake) != 0) {
             $agent_id = array_pop($a_agentList);
             $a_input['plugin_fusioninventory_agents_id'] = $agent_id;
             for ($i = 0; $i < $nb_computers; $i++) {
                 //Add jobstate and put status
                 $a_input['items_id'] = array_pop($a_computers_to_wake);
                 $Taskjobstates_id = $pfTaskjobstate->add($a_input);
                 //Add log of taskjob
                 $a_input['plugin_fusioninventory_taskjobstates_id'] = $Taskjobstates_id;
                 $a_input['state'] = 7;
                 $a_input['date'] = date("Y-m-d H:i:s");
                 $pfTaskjoblog->add($a_input);
                 unset($a_input['state']);
                 if ($communication == "push") {
                     $_SESSION['glpi_plugin_fusioninventory']['agents'][$agent_id] = 1;
                 }
             }
         }
     }
     $pfTaskjob->fields['status'] = 1;
     $pfTaskjob->update($pfTaskjob->fields);
     return $uniqid;
 }
 static function isThisItemCheckRuleNetworkport($parm)
 {
     global $DB;
     $pmComponentscatalog_rule = new self();
     $pmService = new PluginMonitoringService();
     $pmSearch = new PluginMonitoringSearch();
     $a_networkports_id = array();
     if (get_class($parm) == 'PluginMonitoringNetworkport') {
         $a_networkports_id[$parm->fields['networkports_id']] = $parm->fields['items_id'];
     } else {
         if (get_class($parm) == 'NetworkEquipment') {
             $query = "SELECT * FROM `glpi_plugin_monitoring_networkports`\n            WHERE `items_id`='" . $parm->fields['id'] . "'";
             $result = $DB->query($query);
             while ($data = $DB->fetch_array($result)) {
                 $a_networkports_id[$data['networkports_id']] = $parm->fields['id'];
             }
         }
     }
     foreach ($a_networkports_id as $networkports_id => $networkequipments_id) {
         $a_find = array();
         $query = "SELECT * FROM `" . $pmComponentscatalog_rule->getTable() . "`\n            WHERE `itemtype`='PluginMonitoringNetworkport'";
         $result = $DB->query($query);
         $get_tmp = array();
         if (isset($_GET)) {
             $get_tmp = $_GET;
         }
         while ($data = $DB->fetch_array($result)) {
             if (isset($_SESSION["glpisearchcount"][$data['itemtype']])) {
                 unset($_SESSION["glpisearchcount"][$data['itemtype']]);
             }
             if (isset($_SESSION["glpisearchcount2"][$data['itemtype']])) {
                 unset($_SESSION["glpisearchcount2"][$data['itemtype']]);
             }
             $_GET = importArrayFromDB($data['condition']);
             $_GET["glpisearchcount"] = count($_GET['field']);
             if (isset($_GET['field2'])) {
                 $_GET["glpisearchcount2"] = count($_GET['field2']);
             }
             if (!isset($_SESSION['glpiactiveentities_string'])) {
                 $_SESSION['glpiactiveentities_string'] = $parm->fields['entities_id'];
             }
             Search::manageGetValues($data['itemtype']);
             $resultr = $pmSearch->constructSQL("PluginMonitoringNetworkport", $_GET, $networkports_id);
             if ($DB->numrows($resultr) > 0) {
                 $a_find[$data['plugin_monitoring_componentscalalog_id']][$networkports_id] = 1;
             } else {
                 if (!isset($a_find[$data['plugin_monitoring_componentscalalog_id']][$networkports_id])) {
                     $a_find[$data['plugin_monitoring_componentscalalog_id']][$networkports_id] = 0;
                 }
             }
         }
         if (count($get_tmp) > 0) {
             $_GET = $get_tmp;
         }
         $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
         foreach ($a_find as $componentscalalog_id => $datan) {
             foreach ($datan as $networkports_id => $is_present) {
                 // Get all networports in this rule
                 if ($is_present == '0') {
                     // * Remove from dynamic if present
                     $query = "SELECT `glpi_plugin_monitoring_services`.`id`,\n                        `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` as hid\n                        FROM `glpi_plugin_monitoring_services`\n                     LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts` ON\n                        `plugin_monitoring_componentscatalogs_hosts_id` = `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`\n                     WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscalalog_id . "'\n                        AND `itemtype`='NetworkEquipment'\n                        AND `items_id`='" . $networkequipments_id . "'\n                        AND `is_static`='0'\n                        AND `networkports_id`='" . $networkports_id . "'";
                     $result = $DB->query($query);
                     while ($data = $DB->fetch_array($result)) {
                         $pmComponentscatalog_Host->getFromDB($data['hid']);
                         $_SESSION['plugin_monitoring_hosts'] = $pmComponentscatalog_Host->fields;
                         $pmService->delete(array('id' => $data['id']));
                     }
                 } else {
                     //  add if not present
                     // * Add componentscatalogs_hosts if not exist
                     $componentscatalogs_hosts_id = 0;
                     $query = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`\n                     WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscalalog_id . "'\n                        AND `itemtype`='NetworkEquipment'\n                        AND `items_id`='" . $networkequipments_id . "'\n                           LIMIT 1";
                     $result = $DB->query($query);
                     if ($DB->numrows($result) == '0') {
                         $input = array();
                         $input['plugin_monitoring_componentscalalog_id'] = $componentscalalog_id;
                         $input['is_static'] = '0';
                         $input['itemtype'] = "NetworkEquipment";
                         $input['items_id'] = $networkequipments_id;
                         $componentscatalogs_hosts_id = $pmComponentscatalog_Host->add($input);
                     } else {
                         $a_componentscatalogs_hosts = $DB->fetch_assoc($result);
                         $componentscatalogs_hosts_id = $a_componentscatalogs_hosts['id'];
                     }
                     // * Add service if not exist
                     $pmComponentscatalog_Host->linkComponentsToItem($componentscalalog_id, $componentscatalogs_hosts_id, $networkports_id);
                 }
             }
         }
     }
 }
 function showList($get)
 {
     Search::manageGetValues("PluginMonitoringUnavailability");
     Search::showList("PluginMonitoringUnavailability", $get);
 }
Example #18
0
                  $_GET["searchtype"][1] = 'lessthan';
                  $_GET["contains"][1] = $_GET["date"];
            
                  $_GET["link"][2] = 'AND';
                  $_GET["field"][2] = "4377";
                  $_GET["searchtype"][2] = 'contains';
                  $_GET["contains"][2] = 'NULL';
            
                  $_GET["link"][3] = 'OR';
                  $_GET["field"][3] = "4377";
                  $_GET["searchtype"][3] = 'morethan';
                  $_GET["contains"][3] = $_GET["date"];*/
            if (isset($_GET["resource_ranks_id"]) && $_GET["resource_ranks_id"] != 0) {
                $_GET["link"][4] = 'AND';
                $_GET["field"][4] = "4374";
                $_GET["searchtype"][4] = 'equals';
                $_GET["contains"][4] = $_GET["resource_ranks_id"];
            }
        }
    }
    Search::manageGetValues("PluginResourcesRecap");
    $recap->showGenericSearch($_GET);
    $recap->showMinimalList($_GET);
} else {
    Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::footer();
} else {
    Html::helpFooter();
}
Example #19
0
Resources is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    //from central
    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
    //from helpdesk
    Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
$resting = new PluginResourcesResourceResting();
if ($resting->canView() || Session::haveRight("config", "w")) {
    Search::manageGetValues("PluginResourcesResourceResting");
    $resting->showGenericSearch($_GET);
    $resting->showMinimalList($_GET);
} else {
    Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::footer();
} else {
    Html::helpFooter();
}
Example #20
0
$pmMessage = new PluginMonitoringMessage();
$pmMessage->getMessages();
$pmDisplay->menu();
$pmDisplay->refreshPage();
$pmDisplay->showCounters("Ressources", 1, 0);
// Manage search
if (isset($_SESSION['plugin_monitoring']['service'])) {
    $_GET = $_SESSION['plugin_monitoring']['service'];
}
if (isset($_GET['reset'])) {
    unset($_SESSION['glpisearch']['PluginMonitoringService']);
}
if (isset($_GET['glpi_tab'])) {
    unset($_GET['glpi_tab']);
}
Search::manageGetValues("PluginMonitoringService");
if (isset($_GET['hidesearch'])) {
    echo "<table class='tab_cadre_fixe'>";
    echo "<tr class='tab_bg_1'>";
    echo "<th>";
    echo "<a onClick='Ext.get(\"searchform\").toggle();'>\n      <img src='" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png' />&nbsp;\n         " . __('Display search form', 'monitoring') . "\n      &nbsp;<img src='" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png' /></a>";
    echo "</th>";
    echo "</tr>";
    echo "</table>";
    echo "<div style='display: none;' id='searchform'>";
}
Search::showGenericSearch("PluginMonitoringService", $_GET);
if (isset($_GET['hidesearch'])) {
    echo "</div>";
}
$pmDisplay->showBoard(950);
Example #21
0
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
checkCentralAccess();
commonHeader($LANG['search'][0], $_SERVER['PHP_SELF']);
if (isset($_GET["globalsearch"])) {
    $searchtext = $_GET["globalsearch"];
    $types = array('Ticket', 'Computer', 'Monitor', 'Software', 'NetworkEquipment', 'Peripheral', 'Printer', 'Phone', 'Contact', 'Supplier', 'Document');
    foreach ($types as $itemtype) {
        $item = new $itemtype();
        if ($item->canView()) {
            $_GET["reset"] = 'reset';
            $_GET["display_type"] = GLOBAL_SEARCH;
            Search::manageGetValues($itemtype, false, true);
            if ($_GET["field"][0] == 'view') {
                $_GET["contains"][0] = $searchtext;
                $_GET["searchtype"][0] = 'contains';
                $_SESSION["glpisearchcount"][$itemtype] = 1;
            } else {
                $_GET["field"][1] = 'view';
                $_GET["contains"][1] = $searchtext;
                $_GET["searchtype"][1] = 'contains';
                $_SESSION["glpisearchcount"][$itemtype] = 2;
            }
            Search::showList($itemtype, $_GET);
            unset($_GET["contains"]);
            unset($_GET["searchtype"]);
            echo "<hr>";
            $_GET = array();
Example #22
0
http://indepnet.net/   http://glpi-project.org
-------------------------------------------------------------------------

LICENSE

This file is part of GLPI.

GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
Html::popHeader(__('Setup'), $_SERVER['PHP_SELF']);
Search::manageGetValues('DocumentType');
Search::showList('DocumentType', $_GET);
Html::popFooter();
Example #23
0
Projet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Projet is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Projet. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$task = new PluginProjetTask();
Html::header(PluginProjetProjet::getTypeName(2), '', "plugins", "projet");
if ($task->canView() || Session::haveRight("config", "w")) {
    Search::manageGetValues("PluginProjetTask");
    //if $_GET["plugin_projet_projets_id"] exist this show list of tasks from a projet
    //else show all tasks
    if (isset($_GET["plugin_projet_projets_id"]) && !empty($_GET["plugin_projet_projets_id"])) {
        $_GET["field"] = array(0 => "23");
        $_GET["contains"] = array(0 => $_GET["plugin_projet_projets_id"]);
    }
    Search::showGenericSearch("PluginProjetTask", $_GET);
    Search::showList("PluginProjetTask", $_GET);
} else {
    Html::displayRightError();
}
Html::footer();