当前位置: 首页>>代码示例>>PHP>>正文


PHP plugin_resources_haveRight函数代码示例

本文整理汇总了PHP中plugin_resources_haveRight函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_resources_haveRight函数的具体用法?PHP plugin_resources_haveRight怎么用?PHP plugin_resources_haveRight使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了plugin_resources_haveRight函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showMinimalList


//.........这里部分代码省略.........
             $first = false;
         }
         $COMMONWHERE .= $LINK . "`{$itemtable}`.`is_deleted` = '" . $p['is_deleted'] . "' ";
     }
     // Remove template items
     if ($item && $item->maybeTemplate()) {
         $LINK = " AND ";
         if ($first) {
             $LINK = " ";
             $first = false;
         }
         $COMMONWHERE .= $LINK . "`{$itemtable}`.`is_template` = '0' ";
     }
     // Add Restrict to current entities
     if ($entity_restrict) {
         $LINK = " AND ";
         if ($first) {
             $LINK = " ";
             $first = false;
         }
         if ($itemtype == 'Entity') {
             $COMMONWHERE .= getEntitiesRestrictRequest($LINK, $itemtable, 'id', '', true);
         } else {
             if (isset($CFG_GLPI["union_search_type"]["PluginResourcesResource"])) {
                 // Will be replace below in Union/Recursivity Hack
                 $COMMONWHERE .= $LINK . " ENTITYRESTRICT ";
             } else {
                 $COMMONWHERE .= getEntitiesRestrictRequest($LINK, "glpi_plugin_resources_resources", '', '', $PluginResourcesResource->maybeRecursive());
             }
         }
     }
     ///R�cup�ration des groupes de l'utilisateur connect�
     $who = Session::getLoginUserID();
     if (!plugin_resources_haveRight("all", "r")) {
         $LINK = " AND ";
         if ($first) {
             $LINK = " ";
             $first = false;
         }
         $COMMONWHERE .= $LINK . "(`glpi_plugin_resources_resources`.`users_id_recipient` = '{$who}' OR `glpi_plugin_resources_resources`.`users_id` = '{$who}') ";
     }
     $WHERE = "";
     $HAVING = "";
     // Add search conditions
     // If there is search items
     if ($_SESSION["glpisearchcount"][$itemtype] > 0 && count($p['contains']) > 0) {
         for ($key = 0; $key < $_SESSION["glpisearchcount"][$itemtype]; $key++) {
             // if real search (strlen >0) and not all and view search
             if (isset($p['contains'][$key]) && strlen($p['contains'][$key]) > 0) {
                 // common search
                 if ($p['field'][$key] != "all" && $p['field'][$key] != "view") {
                     $LINK = " ";
                     $NOT = 0;
                     $tmplink = "";
                     if (is_array($p['link']) && isset($p['link'][$key])) {
                         if (strstr($p['link'][$key], "NOT")) {
                             $tmplink = " " . str_replace(" NOT", "", $p['link'][$key]);
                             $NOT = 1;
                         } else {
                             $tmplink = " " . $p['link'][$key];
                         }
                     } else {
                         $tmplink = " AND ";
                     }
                     if (isset($searchopt[$itemtype][$p['field'][$key]]["usehaving"])) {
                         // Manage Link if not first item
开发者ID:geldarr,项目名称:hack-space,代码行数:67,代码来源:resourceresting.class.php

示例2: canView

 static function canView()
 {
     if (plugin_resources_haveRight('dropdown_public', 'r')) {
         return true;
     }
     return false;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:7,代码来源:professioncategory.class.php

示例3: canView

 static function canView()
 {
     return plugin_resources_haveRight('budget', 'r');
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:4,代码来源:budgetvolume.class.php

示例4: pdfForResource

 /**
  * Show for PDF an resources - asociated devices
  * 
  * @param $pdf object for the output
  * @param $ID of the resources
  */
 static function pdfForResource(PluginPdfSimplePDF $pdf, PluginResourcesResource $appli)
 {
     global $DB, $CFG_GLPI;
     $ID = $appli->fields['id'];
     if (!$appli->can($ID, "r")) {
         return false;
     }
     if (!plugin_resources_haveRight("resources", "r")) {
         return false;
     }
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . _n('Associated item', 'Associated items', 2) . '</b>');
     $query = "SELECT DISTINCT `itemtype` \n               FROM `glpi_plugin_resources_resources_items` \n               WHERE `plugin_resources_resources_id` = '{$ID}' \n               ORDER BY `itemtype` ";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (Session::isMultiEntitiesMode()) {
         $pdf->setColumnsSize(12, 27, 25, 18, 18);
         $pdf->displayTitle('<b><i>' . __('Type'), __('Name'), __('Entity'), __('Serial Number'), __('Inventory number') . '</i></b>');
     } else {
         $pdf->setColumnsSize(25, 31, 22, 22);
         $pdf->displayTitle('<b><i>' . __('Type'), __('Name'), __('Serial Number'), __('Inventory number') . '</i></b>');
     }
     if (!$number) {
         $pdf->displayLine(__('No item found'));
     } else {
         for ($i = 0; $i < $number; $i++) {
             $type = $DB->result($result, $i, "itemtype");
             if (!($item = getItemForItemtype($type))) {
                 continue;
             }
             if ($item->canView()) {
                 $column = "name";
                 $table = getTableForItemType($type);
                 $items = new $type();
                 $query = "SELECT `" . $table . "`.*, `glpi_entities`.`id` AS entity " . " FROM `glpi_plugin_resources_resources_items`, `" . $table . "` LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `" . $table . "`.`entities_id`) " . " WHERE `" . $table . "`.`id` = `glpi_plugin_resources_resources_items`.`items_id` \n                  AND `glpi_plugin_resources_resources_items`.`itemtype` = '{$type}' \n                  AND `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id` = '{$ID}' ";
                 if ($type != 'User') {
                     $query .= getEntitiesRestrictRequest(" AND ", $table, '', '', $items->maybeRecursive());
                 }
                 if ($items->maybeTemplate()) {
                     $query .= " AND `" . $table . "`.`is_template` = '0'";
                 }
                 $query .= " ORDER BY `glpi_entities`.`completename`, `" . $table . "`.`{$column}`";
                 if ($result_linked = $DB->query($query)) {
                     if ($DB->numrows($result_linked)) {
                         while ($data = $DB->fetch_assoc($result_linked)) {
                             if (!$items->getFromDB($data["id"])) {
                                 continue;
                             }
                             $items_id_display = "";
                             if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
                                 $items_id_display = " (" . $data["id"] . ")";
                             }
                             if ($type == 'User') {
                                 $name = Html::clean(getUserName($data["id"])) . $items_id_display;
                             } else {
                                 $name = $data["name"] . $items_id_display;
                             }
                             if ($type != 'User') {
                                 $entity = Html::clean(Dropdown::getDropdownName("glpi_entities", $data['entity']));
                             } else {
                                 $entity = "-";
                             }
                             if (Session::isMultiEntitiesMode()) {
                                 $pdf->setColumnsSize(12, 27, 25, 18, 18);
                                 $pdf->displayLine($items->getTypeName(), $name, $entity, isset($data["serial"]) ? "" . $data["serial"] . "" : "-", isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-");
                             } else {
                                 $pdf->setColumnsSize(25, 31, 22, 22);
                                 $pdf->displayTitle($items->getTypeName(), $name, isset($data["serial"]) ? "" . $data["serial"] . "" : "-", isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-");
                             }
                         }
                         // Each device
                     }
                 }
                 // numrows device
             }
             // type right
         }
         // each type
     }
     // numrows type
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:87,代码来源:resource_item.class.php

示例5: pdfForResource

 /**
  * Show for PDF an resources : employee informations
  * 
  * @param $pdf object for the output
  * @param $appli PluginResourcesResource Class
  */
 static function pdfForResource(PluginPdfSimplePDF $pdf, PluginResourcesResource $appli)
 {
     global $DB;
     $ID = $appli->fields['id'];
     if (!$appli->can($ID, "r")) {
         return false;
     }
     if (!plugin_resources_haveRight("resources", "r")) {
         return false;
     }
     $query = "SELECT * \n               FROM `glpi_plugin_resources_employees` \n               WHERE `plugin_resources_resources_id` = '{$ID}'";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . self::getTypeName(1) . '</b>');
     $pdf->setColumnsSize(33, 33, 34);
     $pdf->displayTitle('<b><i>' . PluginResourcesEmployer::getTypeName(1), PluginResourcesClient::getTypeName(1) . '</i></b>');
     if (!$number) {
         $pdf->displayLine(__('No item found'));
     } else {
         for ($i = 0; $i < $number; $i++) {
             $employer = $DB->result($result, $i, "plugin_resources_employers_id");
             $client = $DB->result($result, $i, "plugin_resources_clients_id");
             $pdf->displayLine(Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_employers", $employer)), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_clients", $client)));
         }
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:34,代码来源:employee.class.php

示例6: plugin_resources_giveItem

function plugin_resources_giveItem($type, $ID, $data, $num)
{
    global $CFG_GLPI, $DB;
    $searchopt =& Search::getOptions($type);
    $table = $searchopt[$ID]["table"];
    $field = $searchopt[$ID]["field"];
    $output_type = Search::HTML_OUTPUT;
    if (isset($_GET['display_type'])) {
        $output_type = $_GET['display_type'];
    }
    switch ($type) {
        case 'PluginResourcesResource':
            switch ($table . '.' . $field) {
                case "glpi_plugin_resources_resources.name":
                    if (!empty($data["ITEM_" . $num . "_2"])) {
                        $link = Toolbox::getItemTypeFormURL('PluginResourcesResource');
                        $out = "";
                        if ($output_type == Search::HTML_OUTPUT) {
                            $out = "<a href=\"" . $link . "?id=" . $data["ITEM_" . $num . "_2"] . "\">";
                        }
                        $out .= $data["META_{$num}"];
                        if ($output_type == Search::HTML_OUTPUT) {
                            if ($_SESSION["glpiis_ids_visible"] || empty($data["META_{$num}"])) {
                                $out .= " (" . $data["ITEM_" . $num . "_2"] . ")";
                            }
                            $out .= "</a>";
                        }
                        if (plugin_resources_haveRight("task", "r") && $output_type == Search::HTML_OUTPUT) {
                            $query_tasks = "SELECT COUNT(`id`) AS nb_tasks,SUM(`is_finished`) AS is_finished\n                                 FROM `glpi_plugin_resources_tasks`\n                                 WHERE `plugin_resources_resources_id` = '" . $data['id'] . "'\n                                 AND `is_deleted` = '0'";
                            $result_tasks = $DB->query($query_tasks);
                            $nb_tasks = $DB->result($result_tasks, 0, "nb_tasks");
                            $is_finished = $DB->result($result_tasks, 0, "is_finished");
                            $out .= "&nbsp;(<a href=\"" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/task.php?plugin_resources_resources_id=" . $data["id"] . "\">";
                            if ($nb_tasks - $is_finished > 0) {
                                $out .= "<span class='plugin_resources_date_over_color'>";
                                $out .= $nb_tasks - $is_finished . "</span></a>)";
                            } else {
                                $out .= "<span class='plugin_resources_date_day_color'>";
                                $out .= $nb_tasks . "</span></a>)";
                            }
                        }
                    }
                    return $out;
                    break;
                case "glpi_plugin_resources_resources.date_end":
                    if ($data["ITEM_{$num}"] <= date('Y-m-d') && !empty($data["ITEM_{$num}"])) {
                        $out = "<span class='plugin_resources_date_color'>" . Html::convDate($data["ITEM_{$num}"]) . "</span>";
                    } else {
                        if (empty($data["ITEM_{$num}"])) {
                            $out = __('Not defined', 'resources');
                        } else {
                            $out = Html::convDate($data["ITEM_{$num}"]);
                        }
                    }
                    return $out;
                    break;
                case "glpi_plugin_resources_resources_items.items_id":
                    $restrict = "`plugin_resources_resources_id` = '" . $data['id'] . "'\n                           ORDER BY `itemtype`, `items_id`";
                    $items = getAllDatasFromTable("glpi_plugin_resources_resources_items", $restrict);
                    $out = '';
                    if (!empty($items)) {
                        foreach ($items as $device) {
                            if (!class_exists($device["itemtype"])) {
                                continue;
                            }
                            $item = new $device["itemtype"]();
                            $item->getFromDB($device["items_id"]);
                            $out .= $item->getTypeName() . " - ";
                            if ($device["itemtype"] == 'User') {
                                if ($output_type == Search::HTML_OUTPUT) {
                                    $link = Toolbox::getItemTypeFormURL('User');
                                    $out .= "<a href=\"" . $link . "?id=" . $device["items_id"] . "\">";
                                }
                                $out .= getUserName($device["items_id"]);
                                if ($output_type == Search::HTML_OUTPUT) {
                                    $out .= "</a>";
                                }
                            } else {
                                $out .= $item->getLink();
                            }
                            $out .= "<br>";
                        }
                    } else {
                        $out = ' ';
                    }
                    return $out;
                    break;
                case "glpi_plugin_resources_resources.quota":
                    if (!empty($data["ITEM_{$num}"])) {
                        $out = floatval($data["ITEM_{$num}"]);
                    }
                    return $out;
                    break;
            }
            return "";
            break;
        case 'PluginResourcesTask':
            switch ($table . '.' . $field) {
                case "glpi_plugin_resources_resources.name":
                    $out = "";
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:hook.php

示例7: showChildrensTab

 function showChildrensTab()
 {
     return plugin_resources_haveRight('resources', 'w') && count($_SESSION['glpiactiveentities']) > 1;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:4,代码来源:rulecontracttypecollection.class.php

示例8: showReports

 static function showReports($ID, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $rand = mt_rand();
     $resource = new PluginResourcesResource();
     $resource->getFromDB($ID);
     $canedit = $resource->can($ID, 'w');
     Session::initNavigateListItems("PluginResourcesReportConfig", PluginResourcesResource::getTypeName(1) . " = " . $resource->fields["name"]);
     $query = "SELECT `glpi_plugin_resources_reportconfigs`.`id`,\n               `glpi_plugin_resources_reportconfigs`.`plugin_resources_resources_id`,\n                `glpi_plugin_resources_reportconfigs`.`information`, \n                `glpi_plugin_resources_reportconfigs`.`comment`\n                 FROM `glpi_plugin_resources_reportconfigs` ";
     $query .= " LEFT JOIN `glpi_plugin_resources_resources` ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_reportconfigs`.`plugin_resources_resources_id`)";
     $query .= " WHERE `glpi_plugin_resources_reportconfigs`.`plugin_resources_resources_id` = '{$ID}'";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $row_num = 1;
     if ($number != "0") {
         if ($withtemplate < 2) {
             echo "<form method='post' name='form_reports{$rand}' id='form_reports{$rand}' action=\"./reportconfig.form.php\">";
         }
         echo "<div align='center'><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='5'>" . self::getTypeName(1) . "</th></tr>";
         $sel = "";
         if (isset($_GET["select"]) && $_GET["select"] == "all") {
             $sel = "checked";
         }
         echo "<tr>";
         if (plugin_resources_haveRight('resources', 'w') && $canedit && $withtemplate < 2) {
             echo "<th>&nbsp;</th>";
         }
         echo "<th>" . __('Comments') . "</th>";
         echo "<th>" . __('Information', 'Informations', 2) . "</th>";
         if ($withtemplate < 2) {
             echo "<th>&nbsp;</th>";
         }
         echo "</tr>";
         while ($data = $DB->fetch_array($result)) {
             Session::addToNavigateListItems("PluginResourcesReportConfig", $data['id']);
             $i++;
             $row_num++;
             echo "<tr class='tab_bg_1 center'>";
             if (plugin_resources_haveRight('resources', 'w') && $canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 echo "<input type='checkbox' name='check[" . $data["id"] . "]'";
                 if (isset($_POST['check']) && $_POST['check'] == 'all') {
                     echo " checked ";
                 }
                 echo ">";
                 echo "</td>";
             }
             echo "<td class='left'>" . nl2br($data["comment"]) . "</td>";
             echo "<td class='left'>" . nl2br($data["information"]) . "</td>";
             if ($withtemplate < 2) {
                 echo "<td class='center'>";
                 echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/reportconfig.form.php?id=" . $data["id"] . "&amp;plugin_resources_resources_id=" . $data["plugin_resources_resources_id"] . "'>";
                 _e('Update');
                 if ($_SESSION["glpiis_ids_visible"]) {
                     echo " (" . $data["id"] . ")";
                 }
                 echo "</a></td>";
             }
             echo "</tr>";
         }
         echo "</table></div>";
         if ($number && $canedit && $withtemplate < 2) {
             if (plugin_resources_haveRight('resources', 'w')) {
                 Html::openArrowMassives("form_reports{$rand}", true);
                 Html::closeArrowMassives(array('delete_report' => _sx('button', 'Delete permanently')));
             }
         }
         if ($withtemplate < 2) {
             Html::closeForm();
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:74,代码来源:reportconfig.class.php

示例9: pdfForResource

 /**
  * Show for PDF an resources : checklists informations
  * 
  * @param $pdf object for the output
  * @param $ID of the resources
  */
 static function pdfForResource(PluginPdfSimplePDF $pdf, PluginResourcesResource $appli, $checklist_type)
 {
     global $DB;
     $ID = $appli->fields['id'];
     if (!$appli->can($ID, "r")) {
         return false;
     }
     if (!plugin_resources_haveRight("resources", "r")) {
         return false;
     }
     $query = "SELECT * \n               FROM `glpi_plugin_resources_checklists` \n               WHERE `plugin_resources_resources_id` = '{$ID}' \n               AND `checklist_type` = '{$checklist_type}' \n               ORDER BY `rank` ";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = $j = 0;
     $pdf->setColumnsSize(100);
     if ($number > 0) {
         $pdf->displayTitle('<b>' . self::getChecklistType($checklist_type) . '</b>');
         $pdf->setColumnsSize(85, 10, 5);
         $pdf->displayTitle('<b><i>' . __('Name'), __('Linked task', 'resources'), __('Checked', 'resources') . '</i></b>');
         $i++;
         while ($j < $number) {
             $checkedID = $DB->result($result, $j, "is_checked");
             $name = $DB->result($result, $j, "name");
             $task_id = $DB->result($result, $j, "plugin_resources_tasks_id");
             if ($checkedID == 1) {
                 $checked = __('Yes');
             } else {
                 $checked = __('No');
             }
             $pdf->displayLine($name, Dropdown::getYesNo($task_id), $checked);
             $j++;
         }
     } else {
         $pdf->displayLine(__('No checklist found', 'resources'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:43,代码来源:checklist.class.php

示例10: showMenu

 /**
  * Display menu
  */
 function showMenu()
 {
     global $CFG_GLPI;
     echo "<div align='center'><table class='tab_cadre' width='30%' cellpadding='5'>";
     echo "<tr><th colspan='4'>" . __('Menu', 'resources') . "</th></tr>";
     $canresting = plugin_resources_haveRight('resting', 'w');
     $canholiday = plugin_resources_haveRight('holiday', 'w');
     $canemployment = plugin_resources_haveRight('employment', 'w');
     $canseeemployment = plugin_resources_haveRight('employment', 'r');
     $canseebudget = plugin_resources_haveRight('budget', 'r');
     $colspan = "1";
     $colspan2 = "1";
     if (!$this->canCreate()) {
         $colspan += 3;
     }
     if (!$canresting || !$canholiday) {
         $colspan2 += 1;
     }
     echo "<tr><th colspan='4'>" . __('Resources management', 'resources') . "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     if ($this->canCreate()) {
         //Add a resource
         echo "<td class='center'>";
         echo "<a href=\"./wizard.form.php\">";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/newresource.png' alt='" . __('Declare an arrival', 'resources') . "'>";
         echo "<br>" . __('Declare an arrival', 'resources') . "</a>";
         echo "</td>";
         //See resources
         echo "<td class='center'>";
         echo "<a href=\"./resource.php\">";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/resourcelist.png' alt='" . __('Search resources', 'resources') . "'>";
         echo "<br>" . __('Search resources', 'resources') . "</a>";
         echo "</td>";
         //Remove resources
         echo "<td class='center'>";
         echo "<a href=\"./resource.remove.php\">";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/removeresource.png' alt='" . __('Declare a departure', 'resources') . "'>";
         echo "<br>" . __('Declare a departure', 'resources') . "</a>";
         echo "</td>";
     }
     echo "<td colspan='{$colspan}' class='center'>";
     echo "<a href=\"./directory.php\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/directory.png' alt='" . PluginResourcesDirectory::getTypeName(1) . "'>";
     echo "<br>" . PluginResourcesDirectory::getTypeName(1) . "</a>";
     echo "</td>";
     echo "</tr>";
     if ($canresting || $canholiday) {
         echo "<tr><th colspan='4'>" . __('Others declarations', 'resources') . "</th></tr>";
         echo "<tr class='tab_bg_1'>";
         if ($canresting) {
             //Add resting resource
             echo "<td colspan='{$colspan2}' class='center'>";
             echo "<a href=\"./resourceresting.form.php\">";
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/newresting.png' alt='" . __('Declare a non contract period', 'resources') . "'>";
             echo "<br>" . __('Declare a non contract period', 'resources') . "</a>";
             echo "</td>";
             //List resting resource
             echo "<td colspan='{$colspan2}' class='center'>";
             echo "<a href=\"./resourceresting.php\">";
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/restinglist.png' alt='" . __('List of non contract periods', 'resources') . "'>";
             echo "<br>" . __('List of non contract periods', 'resources') . "</a>";
             echo "</td>";
         }
         if ($canholiday) {
             echo "<td colspan='{$colspan2}' class='center'>";
             echo "<a href=\"./resourceholiday.form.php\">";
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/holidayresource.png' alt='" . __('Declare a forced holiday', 'resources') . "'>";
             echo "<br>" . __('Declare a forced holiday', 'resources') . "</a>";
             echo "</td>";
             echo "<td colspan='{$colspan2}' class='center'>";
             echo "<a href=\"./resourceholiday.php\">";
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/holidaylist.png' alt='" . __('List of forced holidays', 'resources') . "'>";
             echo "<br>" . __('List of forced holidays', 'resources') . "</a>";
             echo "</td>";
         }
         echo "</tr>";
     }
     if ($canseeemployment || $canseebudget) {
         echo "<tr><th colspan='4'>" . __('Employments / budgets management', 'resources') . "</th></tr>";
         echo "<tr class='tab_bg_1'>";
         if ($canseeemployment) {
             if ($canemployment) {
                 //Add an employment
                 echo "<td class='center'>";
                 echo "<a href=\"./employment.form.php\">";
                 echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/employment.png' alt='" . __('Declare an employment', 'resources') . "'>";
                 echo "<br>" . __('Declare an employment', 'resources') . "</a>";
                 echo "</td>";
             }
             //See managment employments
             echo "<td class='center'>";
             echo "<a href=\"./employment.php\">";
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/employmentlist.png' alt='" . __('Employment management', 'resources') . "'>";
             echo "<br>" . __('Employment management', 'resources') . "</a>";
             echo "</td>";
         }
         if ($canseebudget) {
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:resource.class.php

示例11: getActions

 function getActions()
 {
     $actions = array();
     $actions['requiredfields_name']['name'] = __('Name');
     $actions['requiredfields_name']['type'] = "yesonly";
     $actions['requiredfields_name']['force_actions'] = array('assign');
     $actions['requiredfields_name']['type'] = "yesonly";
     $actions['requiredfields_firstname']['name'] = __('First name');
     $actions['requiredfields_firstname']['type'] = "yesonly";
     $actions['requiredfields_firstname']['force_actions'] = array('assign');
     $actions['requiredfields_locations_id']['name'] = __('Location');
     $actions['requiredfields_locations_id']['type'] = "yesonly";
     $actions['requiredfields_locations_id']['force_actions'] = array('assign');
     $actions['requiredfields_users_id']['name'] = __('Resource manager', 'resources');
     $actions['requiredfields_users_id']['type'] = "yesonly";
     $actions['requiredfields_users_id']['force_actions'] = array('assign');
     $actions['requiredfields_plugin_resources_departments_id']['name'] = PluginResourcesDepartment::getTypeName(1);
     $actions['requiredfields_plugin_resources_departments_id']['type'] = "yesonly";
     $actions['requiredfields_plugin_resources_departments_id']['force_actions'] = array('assign');
     $actions['requiredfields_date_begin']['name'] = __('Arrival date', 'resources');
     $actions['requiredfields_date_begin']['type'] = "yesonly";
     $actions['requiredfields_date_begin']['force_actions'] = array('assign');
     $actions['requiredfields_date_end']['name'] = __('Departure date', 'resources');
     $actions['requiredfields_date_end']['type'] = "yesonly";
     $actions['requiredfields_date_end']['force_actions'] = array('assign');
     $actions['requiredfields_quota']['name'] = __('Quota', 'resources');
     $actions['requiredfields_quota']['type'] = "yesonly";
     $actions['requiredfields_quota']['force_actions'] = array('assign');
     if (plugin_resources_haveRight('dropdown_public', 'w')) {
         $actions['requiredfields_plugin_resources_resourcesituations_id']['name'] = PluginResourcesResourceSituation::getTypeName(1);
         $actions['requiredfields_plugin_resources_resourcesituations_id']['type'] = "yesonly";
         $actions['requiredfields_plugin_resources_resourcesituations_id']['force_actions'] = array('assign');
         $actions['requiredfields_plugin_resources_ranks_id']['name'] = PluginResourcesRank::getTypeName(1);
         $actions['requiredfields_plugin_resources_ranks_id']['type'] = "yesonly";
         $actions['requiredfields_plugin_resources_ranks_id']['force_actions'] = array('assign');
     }
     return $actions;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:38,代码来源:rulecontracttype.class.php

示例12: pdfForResource

 /**
  * Show for PDF an resources : tasks informations
  * 
  * @param $pdf object for the output
  * @param $ID of the resources
  */
 static function pdfForResource(PluginPdfSimplePDF $pdf, PluginResourcesResource $appli)
 {
     global $DB;
     $ID = $appli->fields['id'];
     if (!$appli->can($ID, "r")) {
         return false;
     }
     if (!plugin_resources_haveRight("resources", "r")) {
         return false;
     }
     $query = "SELECT * \n               FROM `glpi_plugin_resources_tasks` \n               WHERE `plugin_resources_resources_id` = '{$ID}'\n               AND `is_deleted` ='0'";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = $j = 0;
     $pdf->setColumnsSize(100);
     if ($number > 0) {
         $pdf->displayTitle('<b>' . self::getTypeName(2) . '</b>');
         $pdf->setColumnsSize(14, 14, 14, 14, 16, 14, 14);
         $pdf->displayTitle('<b><i>' . __('Name'), __('Type'), __('Comments'), __('Duration'), __('Planning'), __('Resource manager', 'resources'), __('Group') . '</i></b>');
         $i++;
         while ($j < $number) {
             $tID = $DB->result($result, $j, "id");
             $actiontime_ID = $DB->result($result, $j, "actiontime");
             $actiontime = '';
             $units = Toolbox::getTimestampTimeUnits($actiontime_ID);
             $hour = $units['hour'];
             $minute = $units['minute'];
             if ($hour) {
                 $actiontime = $hour . __('Hour', 'Hours', 2);
             }
             if ($minute || !$hour) {
                 $actiontime .= $minute . __('Minute', 'Minutes', 2);
             }
             $restrict = " `plugin_resources_tasks_id` = '" . $tID . "' ";
             $plans = getAllDatasFromTable("glpi_plugin_resources_taskplannings", $restrict);
             if (!empty($plans)) {
                 foreach ($plans as $plan) {
                     $planification = Html::convDateTime($plan["begin"]) . "&nbsp;->&nbsp;" . Html::convDateTime($plan["end"]);
                 }
             } else {
                 $planification = __('None');
             }
             $users_id = $DB->result($result, $j, "users_id");
             $managers = Html::clean(getUserName($users_id));
             $name = $DB->result($result, $j, "name");
             $task_type = $DB->result($result, $j, "plugin_resources_tasktypes_id");
             $comment = $DB->result($result, $j, "comment");
             $groups_id = $DB->result($result, $j, "groups_id");
             $pdf->displayLine(Html::clean($name), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_tasktypes", $task_type)), $comment, $actiontime, Html::clean($planification), $managers, Html::clean(Dropdown::getDropdownName("glpi_groups", $groups_id)));
             $j++;
         }
     } else {
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:62,代码来源:task.class.php

示例13: PluginResourcesResource

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';
//central or helpdesk access
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
    Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
$resource = new PluginResourcesResource();
if ($resource->canView() || Session::haveRight("config", "w")) {
    if (plugin_resources_haveRight("all", "w")) {
        //Have right to see all resources
        //Have not right to see all resources
        echo "<div align='center'><script type='text/javascript'>";
        echo "cleanhide('modal_resource_content');";
        echo "var account_window=new Ext.Window({\n            layout:'fit',\n            width:800,\n            height:400,\n            closeAction:'hide',\n            modal: true,\n            autoScroll: true,\n            title: \"" . __('View by contract type', 'resources') . "\",\n            autoLoad: '" . $CFG_GLPI['root_doc'] . "/plugins/resources/ajax/resourcetree.php'\n         });";
        echo "</script>";
        echo "<a onclick='account_window.show();' href='#modal_resource_content' title='" . __('View by contract type', 'resources') . "'>" . __('View by contract type', 'resources') . "</a>";
        echo "</div>";
    }
    Search::show("PluginResourcesResource", $_GET);
} else {
    Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::footer();
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:resource.php

示例14: plugin_init_resources

function plugin_init_resources()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['resources'] = true;
    $PLUGIN_HOOKS['change_profile']['resources'] = array('PluginResourcesProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['resources'] = true;
    if (Session::getLoginUserID()) {
        $noupdate = false;
        if (isset($_SESSION['glpiactiveprofile']['interface']) && $_SESSION['glpiactiveprofile']['interface'] != 'central') {
            $noupdate = true;
        }
        Plugin::registerClass('PluginResourcesResource', array('linkuser_types' => true, 'document_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'notificationtemplates_types' => true, 'unicity_types' => true, 'massiveaction_nodelete_types' => $noupdate, 'massiveaction_noupdate_types' => $noupdate));
        Plugin::registerClass('PluginResourcesDirectory', array('massiveaction_nodelete_types' => true, 'massiveaction_noupdate_types' => true));
        Plugin::registerClass('PluginResourcesRecap', array('massiveaction_nodelete_types' => true, 'massiveaction_noupdate_types' => true));
        Plugin::registerClass('PluginResourcesTaskPlanning', array('planning_types' => true));
        Plugin::registerClass('PluginResourcesRuleChecklistCollection', array('rulecollections_types' => true));
        Plugin::registerClass('PluginResourcesRuleContracttypeCollection', array('rulecollections_types' => true));
        Plugin::registerClass('PluginResourcesProfile', array('addtabon' => 'Profile'));
        Plugin::registerClass('PluginResourcesEmployment', array('massiveaction_nodelete_types' => true));
        if (class_exists('PluginPositionsPosition')) {
            PluginPositionsPosition::registerType('PluginResourcesResource');
            //$PLUGIN_HOOKS['plugin_positions']['PluginResourcesResource']='plugin_resources_positions_pics';
        }
        if (class_exists('PluginBehaviorsCommon')) {
            PluginBehaviorsCommon::addCloneType('PluginResourcesRuleChecklist', 'PluginBehaviorsRule');
            PluginBehaviorsCommon::addCloneType('PluginResourcesRuleContracttype', 'PluginBehaviorsRule');
        }
        if (class_exists('PluginTreeviewConfig')) {
            PluginTreeviewConfig::registerType('PluginResourcesResource');
            $PLUGIN_HOOKS['treeview']['PluginResourcesResource'] = '../resources/pics/miniresources.png';
            $PLUGIN_HOOKS['treeview_params']['resources'] = array('PluginResourcesResource', 'showResourceTreeview');
        }
        if (plugin_resources_haveRight("resources", "r") || plugin_resources_haveRight("employer", "w")) {
            $PLUGIN_HOOKS['menu_entry']['resources'] = 'front/menu.php';
            $PLUGIN_HOOKS['helpdesk_menu_entry']['resources'] = '/front/menu.php';
            $PLUGIN_HOOKS['submenu_entry']['resources']['search'] = 'front/resource.php';
            $PLUGIN_HOOKS['redirect_page']['resources'] = "front/resource.form.php";
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/directory18.png' title='" . __('Directory', 'resources') . "' alt='" . __('Directory', 'resources') . "'>"] = 'front/directory.php';
        }
        if (plugin_resources_haveRight("resting", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/restinglist18.png' title='" . __('List of non contract periods', 'resources') . "' alt='" . __('List of non contract periods', 'resources') . "'>"] = 'front/resourceresting.php';
        }
        if (plugin_resources_haveRight("holiday", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/holidaylist18.png' title='" . __('List of forced holidays', 'resources') . "' alt='" . __('List of forced holidays', 'resources') . "'>"] = 'front/resourceholiday.php';
        }
        if (plugin_resources_haveRight("employment", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/employmentlist18.png' title='" . __('Employment management', 'resources') . "' alt='" . __('Employment management', 'resources') . "'>"] = 'front/employment.php';
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/recap18.png' title='" . __('List Employments / Resources', 'resources') . "' alt='" . __('List Employments / Resources', 'resources') . "'>"] = 'front/recap.php';
        }
        if (plugin_resources_haveRight("budget", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/budgetlist18.png' title='" . __('Budget management', 'resources') . "' alt='" . __('Budget management', 'resources') . "'>"] = 'front/budget.php';
        }
        if (plugin_resources_haveRight("resources", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']['add'] = 'front/wizard.form.php';
            $PLUGIN_HOOKS['submenu_entry']['resources']['template'] = 'front/setup.templates.php?add=0';
            if (plugin_resources_haveRight("task", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']["<img  src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' title='" . __('Tasks list', 'resources') . "' alt='" . __('Tasks list', 'resources') . "'>"] = 'front/task.php';
            }
            if (plugin_resources_haveRight("checklist", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']["<img  src='" . $CFG_GLPI["root_doc"] . "/pics/reservation-3.png' title='" . _n('Checklist', 'Checklists', 2, 'resources') . "' alt='" . _n('Checklist', 'Checklists', 2, 'resources') . "'>"] = 'front/checklistconfig.php';
            }
            if (plugin_resources_haveRight("checklist", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['title'] = __('Checklists', 'resources');
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['page'] = '/plugins/resources/front/checklistconfig.php';
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['links']['search'] = '/plugins/resources/front/checklistconfig.php';
            }
            if (plugin_resources_haveRight("checklist", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['links']['add'] = '/plugins/resources/front/checklistconfig.form.php?new=1';
            }
            if (plugin_resources_haveRight("employment", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['title'] = __('Employments', 'resources');
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['page'] = '/plugins/resources/front/employment.php';
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['links']['search'] = '/plugins/resources/front/employment.php';
            }
            if (plugin_resources_haveRight("employment", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['links']['add'] = '/plugins/resources/front/employment.form.php';
            }
            if (plugin_resources_haveRight("budget", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['title'] = _n('Budget', 'Budgets', 2);
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['page'] = '/plugins/resources/front/budget.php';
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['links']['search'] = '/plugins/resources/front/budget.php';
            }
            if (plugin_resources_haveRight("budget", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['links']['add'] = '/plugins/resources/front/budget.form.php';
            }
            if (Session::haveRight("config", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['links']['config'] = '/plugins/resources/front/config.form.php';
            }
            $PLUGIN_HOOKS['use_massive_action']['resources'] = 1;
        }
        // Add specific files to add to the header : javascript or css
        $PLUGIN_HOOKS['add_javascript']['resources'] = "resources.js";
        $PLUGIN_HOOKS['add_css']['resources'] = "resources.css";
        //TODO : Check
        $PLUGIN_HOOKS['plugin_pdf']['PluginResourcesResource'] = 'PluginResourcesResourcePDF';
        //Clean Plugin on Profile delete
        if (class_exists('PluginResourcesResource_Item')) {
            // only if plugin activated
            $PLUGIN_HOOKS['pre_item_purge']['resources'] = array('Profile' => array('PluginResourcesProfile', 'purgeProfiles'));
            $PLUGIN_HOOKS['plugin_datainjection_populate']['resources'] = 'plugin_datainjection_populate_resources';
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:setup.php


注:本文中的plugin_resources_haveRight函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。