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


PHP Project::getTypeName方法代码示例

本文整理汇总了PHP中Project::getTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getTypeName方法的具体用法?PHP Project::getTypeName怎么用?PHP Project::getTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Project的用法示例。


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

示例1: showForProject

 /**
  * Print the project costs
  *
  * @param $project               Project object
  * @param $withtemplate  boolean  Template or basic item (default '')
  *
  * @return Nothing (call to classes members)
  **/
 static function showForProject(Project $project, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $ID = $project->fields['id'];
     if (!$project->getFromDB($ID) || !$project->can($ID, READ)) {
         return false;
     }
     $canedit = $project->can($ID, UPDATE);
     echo "<div class='center'>";
     $query = "SELECT *\n                FROM `glpi_projectcosts`\n                WHERE `projects_id` = '{$ID}'\n                ORDER BY `begin_date`";
     $rand = mt_rand();
     if ($canedit) {
         echo "<div id='viewcost" . $ID . "_{$rand}'></div>\n";
         echo "<script type='text/javascript' >\n";
         echo "function viewAddCost" . $ID . "_{$rand}() {\n";
         $params = array('type' => __CLASS__, 'parenttype' => 'Project', 'projects_id' => $ID, 'id' => -1);
         Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
         echo "};";
         echo "</script>\n";
         echo "<div class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddCost" . $ID . "_{$rand}();'>";
         echo __('Add a new cost') . "</a></div>\n";
     }
     $total = 0;
     if ($result = $DB->query($query)) {
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr class='noHover'><th colspan='5'>" . self::getTypeName($DB->numrows($result)) . "</th></tr>";
         if ($DB->numrows($result)) {
             echo "<tr><th>" . __('Name') . "</th>";
             echo "<th>" . __('Begin date') . "</th>";
             echo "<th>" . __('End date') . "</th>";
             echo "<th>" . __('Budget') . "</th>";
             echo "<th>" . __('Cost') . "</th>";
             echo "</tr>";
             Session::initNavigateListItems(__CLASS__, sprintf(__('%1$s = %2$s'), Project::getTypeName(1), $project->getName()));
             while ($data = $DB->fetch_assoc($result)) {
                 echo "<tr class='tab_bg_2' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditCost" . $data['projects_id'] . "_" . $data['id'] . "_{$rand}();\"" : '') . ">";
                 $name = empty($data['name']) ? sprintf(__('%1$s (%2$s)'), $data['name'], $data['id']) : $data['name'];
                 echo "<td>";
                 printf(__('%1$s %2$s'), $name, Html::showToolTip($data['comment'], array('display' => false)));
                 if ($canedit) {
                     echo "\n<script type='text/javascript' >\n";
                     echo "function viewEditCost" . $data['projects_id'] . "_" . $data["id"] . "_{$rand}() {\n";
                     $params = array('type' => __CLASS__, 'parenttype' => 'Project', 'projects_id' => $data["projects_id"], 'id' => $data["id"]);
                     Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
                     echo "};";
                     echo "</script>\n";
                 }
                 echo "</td>";
                 echo "<td>" . Html::convDate($data['begin_date']) . "</td>";
                 echo "<td>" . Html::convDate($data['end_date']) . "</td>";
                 echo "<td>" . Dropdown::getDropdownName('glpi_budgets', $data['budgets_id']) . "</td>";
                 echo "<td class='numeric'>" . Html::formatNumber($data['cost']) . "</td>";
                 $total += $data['cost'];
                 echo "</tr>";
                 Session::addToNavigateListItems(__CLASS__, $data['id']);
             }
             echo "<tr class='b noHover'><td colspan='3'>&nbsp;</td>";
             echo "<td class='right'>" . __('Total cost') . '</td>';
             echo "<td class='numeric'>" . Html::formatNumber($total) . '</td></tr>';
         } else {
             echo "<tr><th colspan='5'>" . __('No item found') . "</th></tr>";
         }
         echo "</table>";
     }
     echo "</div>";
     echo "<div>";
     $ticketcost = TicketCost::showForObject($project);
     echo "</div>";
     echo "<div class='b'>";
     printf(__('%1$s: %2$s'), __('Total cost'), $total + $ticketcost);
     echo "</div>";
 }
开发者ID:kipman,项目名称:glpi,代码行数:80,代码来源:projectcost.class.php

示例2: showForTicket

 /**
  * Show projecttasks for a ticket
  *
  * @param $ticket Ticket object
  **/
 static function showForTicket(Ticket $ticket)
 {
     global $DB, $CFG_GLPI;
     $ID = $ticket->getField('id');
     if (!$ticket->can($ID, READ)) {
         return false;
     }
     $canedit = $ticket->canEdit($ID);
     $rand = mt_rand();
     $query = "SELECT DISTINCT `glpi_projecttasks_tickets`.`id` AS linkID,\n                                `glpi_projecttasks`.*\n                FROM `glpi_projecttasks`\n                LEFT JOIN `glpi_projecttasks_tickets`\n                   ON (`glpi_projecttasks_tickets`.`projecttasks_id` = `glpi_projecttasks`.`id`)\n                WHERE `glpi_projecttasks_tickets`.`tickets_id` = '{$ID}'\n                ORDER BY `glpi_projecttasks`.`name`";
     $result = $DB->query($query);
     $pjtasks = array();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $pjtasks[$data['id']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     //       if ($canedit) {
     //          echo "<div class='firstbloc'>";
     //          echo "<form name='projecttaskticket_form$rand' id='projecttaskticket_form$rand'
     //                 method='post' action='".Toolbox::getItemTypeFormURL(__CLASS__)."'>";
     //
     //          echo "<table class='tab_cadre_fixe'>";
     //          echo "<tr class='tab_bg_2'><th colspan='3'>".__('Add a project task')."</th></tr>";
     //
     //          echo "<tr class='tab_bg_2'><td class='right'>";
     //          echo "<input type='hidden' name='tickets_id' value='$ID'>";
     //          $condition = "`glpi_projecttasks`.`projectstates_id` <> 3";
     //          ProjectTask::dropdown(array('used'        => $used,
     //                                      'entity'      => $ticket->getEntityID(),
     //                                      'entity_sons' => $ticket->isRecursive(),
     //                                      'condition'   => $condition,
     //                                      'displaywith' => array('id')));
     //          echo "</td><td width='20%'>";
     // //          echo "<a href='".Toolbox::getItemTypeFormURL('ProjectTask')."?tickets_id=$ID'>";
     // //                 _e('Create a project task from this ticket');
     // //          echo "</a>";
     //          echo "</td><td class='center'>";
     //          echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='submit'>";
     //          echo "</td></tr>";
     //
     //          echo "</table>";
     //          Html::closeForm();
     //          echo "</div>";
     //       }
     echo "<div class='spaced'>";
     if ($numrows) {
         $columns = array('projectname' => Project::getTypeName(Session::getPluralNumber()), 'name' => ProjectTask::getTypeName(Session::getPluralNumber()), 'tname' => __('Type'), 'sname' => __('Status'), 'percent_done' => __('Percent done'), 'plan_start_date' => __('Planned start date'), 'plan_end_date' => __('Planned end date'), 'planned_duration' => __('Planned duration'), '_effect_duration' => __('Effective duration'), 'fname' => __('Father'));
         if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
             $order = "DESC";
         } else {
             $order = "ASC";
         }
         if (!isset($_GET["sort"]) || empty($_GET["sort"])) {
             $_GET["sort"] = "plan_start_date";
         }
         if (isset($_GET["sort"]) && !empty($_GET["sort"]) && isset($columns[$_GET["sort"]])) {
             $sort = "`" . $_GET["sort"] . "`";
         } else {
             $sort = "`plan_start_date` {$order}, `name`";
         }
         $query = "SELECT `glpi_projecttasks`.*,\n                       `glpi_projecttasktypes`.`name` AS tname,\n                       `glpi_projectstates`.`name` AS sname,\n                       `glpi_projectstates`.`color`,\n                       `father`.`name` AS fname,\n                       `father`.`id` AS fID,\n                       `glpi_projects`.`name` AS projectname,\n                       `glpi_projects`.`content` AS projectcontent\n                FROM `glpi_projecttasks`\n                LEFT JOIN `glpi_projecttasktypes`\n                   ON (`glpi_projecttasktypes`.`id` = `glpi_projecttasks`.`projecttasktypes_id`)\n                LEFT JOIN `glpi_projectstates`\n                   ON (`glpi_projectstates`.`id` = `glpi_projecttasks`.`projectstates_id`)\n                LEFT JOIN `glpi_projecttasks` as father\n                   ON (`father`.`id` = `glpi_projecttasks`.`projecttasks_id`)\n                LEFT JOIN `glpi_projecttasks_tickets`\n                   ON (`glpi_projecttasks_tickets`.`projecttasks_id` = `glpi_projecttasks`.`id`)\n                LEFT JOIN `glpi_projects`\n                   ON (`glpi_projecttasks`.`projects_id` = `glpi_projects`.`id`)\n                WHERE `glpi_projecttasks_tickets`.`tickets_id` = '{$ID}'\n                ORDER BY {$sort} {$order}";
         Session::initNavigateListItems('ProjectTask', sprintf(__('%1$s = %2$s'), $ticket::getTypeName(1), $ticket->getName()));
         if ($result = $DB->query($query)) {
             if ($DB->numrows($result)) {
                 echo "<table class='tab_cadre_fixehov'>";
                 echo "<tr><th colspan='10'>" . ProjectTask::getTypeName($numrows) . "</th>";
                 echo "</tr>";
                 $sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
                 $header = '<tr>';
                 foreach ($columns as $key => $val) {
                     // Non order column
                     if ($key[0] == '_') {
                         $header .= "<th>{$val}</th>";
                     } else {
                         $header .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>{$val}</a></th>";
                     }
                 }
                 $header .= "</tr>\n";
                 echo $header;
                 while ($data = $DB->fetch_assoc($result)) {
                     Session::addToNavigateListItems('ProjectTask', $data['id']);
                     $rand = mt_rand();
                     echo "<tr class='tab_bg_2'>";
                     echo "<td>";
                     $link = "<a id='Project" . $data["projects_id"] . $rand . "' href='project.form.php?id=" . $data['projects_id'] . "'>" . $data['projectname'] . (empty($data['projectname']) ? "(" . $data['projects_id'] . ")" : "") . "</a>";
                     echo sprintf(__('%1$s %2$s'), $link, Html::showToolTip($data['projectcontent'], array('display' => false, 'applyto' => "Project" . $data["projects_id"] . $rand)));
                     echo "</td>";
                     echo "<td>";
                     $link = "<a id='ProjectTask" . $data["id"] . $rand . "' href='projecttask.form.php?id=" . $data['id'] . "'>" . $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "</a>";
                     echo sprintf(__('%1$s %2$s'), $link, Html::showToolTip($data['content'], array('display' => false, 'applyto' => "ProjectTask" . $data["id"] . $rand)));
                     echo "</td>";
                     echo "<td>" . $data['tname'] . "</td>";
//.........这里部分代码省略.........
开发者ID:kipman,项目名称:glpi,代码行数:101,代码来源:projecttask_ticket.class.php

示例3: sprintf

    } else {
        if (isset($_POST["restore"])) {
            $project->check($_POST["id"], DELETE);
            $project->restore($_POST);
            Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $project->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $project->check($_POST["id"], PURGE);
                $project->delete($_POST, 1);
                Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
                $project->redirectToList();
            } else {
                if (isset($_POST["update"])) {
                    $project->check($_POST["id"], UPDATE);
                    $project->update($_POST);
                    Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
                    Html::back();
                } else {
                    Html::header(Project::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "tools", "project");
                    if (isset($_GET['showglobalgantt']) && $_GET['showglobalgantt']) {
                        $project->showGantt(-1);
                    } else {
                        $project->display($_GET);
                    }
                    Html::footer();
                }
            }
        }
    }
}
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:project.form.php

示例4: showChildren

 /**
  * Print the HTML array children of a TreeDropdown
  *
  * @return Nothing (display)
  **/
 function showChildren()
 {
     global $DB, $CFG_GLPI;
     $ID = $this->getID();
     $this->check($ID, READ);
     $rand = mt_rand();
     $query = "SELECT *\n                FROM `" . $this->getTable() . "`\n                WHERE `" . $this->getForeignKeyField() . "` = '{$ID}'";
     if ($result = $DB->query($query)) {
         $numrows = $DB->numrows($result);
     }
     if ($this->can($ID, UPDATE)) {
         echo "<div class='firstbloc'>";
         echo "<form name='project_form{$rand}' id='project_form{$rand}' method='post'\n         action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<a href='" . Toolbox::getItemTypeFormURL('Project') . "?projects_id={$ID}'>";
         _e('Create a sub project from this project');
         echo "</a>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixehov'>";
     echo "<tr class='noHover'><th colspan='12'>" . Project::getTypeName($numrows) . "</th></tr>";
     if ($numrows) {
         Project::commonListHeader();
         Session::initNavigateListItems('Project', sprintf(__('%1$s = %2$s'), Project::getTypeName(1), $this->fields["name"]));
         $i = 0;
         while ($data = $DB->fetch_assoc($result)) {
             Session::addToNavigateListItems('Project', $data["id"]);
             Project::showShort($data['id'], array('row_num' => $i));
             $i++;
         }
         Project::commonListHeader();
     }
     echo "</table>";
     echo "</div>\n";
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:41,代码来源:project.class.php

示例5: showForChange

 /**
  * Show projects for a change
  *
  * @param $change Change object
  **/
 static function showForChange(Change $change)
 {
     global $DB, $CFG_GLPI;
     $ID = $change->getField('id');
     if (!$change->can($ID, READ)) {
         return false;
     }
     $canedit = $change->canEdit($ID);
     $rand = mt_rand();
     $showentities = Session::isMultiEntitiesMode();
     $query = "SELECT DISTINCT `glpi_changes_projects`.`id` AS linkID,\n                                `glpi_projects`.*\n                FROM `glpi_changes_projects`\n                LEFT JOIN `glpi_projects`\n                     ON (`glpi_changes_projects`.`projects_id` = `glpi_projects`.`id`)\n                WHERE `glpi_changes_projects`.`changes_id` = '{$ID}'\n                ORDER BY `glpi_projects`.`name`";
     $result = $DB->query($query);
     $projects = array();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $projects[$data['id']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='changeproject_form{$rand}' id='changeproject_form{$rand}' method='post'\n                action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add a project') . "</th></tr>";
         echo "<tr class='tab_bg_2'><td>";
         echo "<input type='hidden' name='changes_id' value='{$ID}'>";
         Project::dropdown(array('used' => $used, 'entity' => $change->getEntityID()));
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr></table>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $numrows) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
     echo "<tr class='noHover'><th colspan='12'>" . Project::getTypeName($numrows) . "</th></tr>";
     if ($numrows) {
         Project::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
         Session::initNavigateListItems('Project', sprintf(__('%1$s = %2$s'), Change::getTypeName(1), $change->fields["name"]));
         $i = 0;
         foreach ($projects as $data) {
             Session::addToNavigateListItems('Project', $data["id"]);
             Project::showShort($data['id'], array('row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID']));
             $i++;
         }
         Project::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
     }
     echo "</table>";
     if ($canedit && $numrows) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:66,代码来源:change_project.class.php

示例6: showChildren

 /**
  * Print the HTML array children of a TreeDropdown
  *
  * @return Nothing (display)
  **/
 function showChildren()
 {
     global $DB, $CFG_GLPI;
     $ID = $this->getID();
     $this->check($ID, READ);
     $rand = mt_rand();
     $query = "SELECT *\n                FROM `" . $this->getTable() . "`\n                WHERE `" . $this->getForeignKeyField() . "` = '{$ID}'";
     if ($result = $DB->query($query)) {
         $numrows = $DB->numrows($result);
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
     echo "<tr class='noHover'><th colspan='12'>" . Project::getTypeName($numrows) . "</th></tr>";
     if ($numrows) {
         Project::commonListHeader();
         Session::initNavigateListItems('Project', sprintf(__('%1$s = %2$s'), Project::getTypeName(1), $this->fields["name"]));
         $i = 0;
         while ($data = $DB->fetch_assoc($result)) {
             Session::addToNavigateListItems('Project', $data["id"]);
             Project::showShort($data['id'], array('row_num' => $i));
             $i++;
         }
         Project::commonListHeader();
     }
     echo "</table>";
     echo "</div>\n";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:32,代码来源:project.class.php

示例7: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         $nb = 0;
         switch ($item->getType()) {
             case 'Project':
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = countElementsInTable('glpi_items_projects', "`projects_id` = '" . $item->getID() . "'");
                 }
                 return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb);
             default:
                 // Not used now
                 if (Session::haveRight("project", Project::READALL)) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         // Direct one
                         $nb = countElementsInTable('glpi_items_projects', " `itemtype` = '" . $item->getType() . "'\n                                                   AND `items_id` = '" . $item->getID() . "'");
                         // Linked items
                         $linkeditems = $item->getLinkedItems();
                         if (count($linkeditems)) {
                             foreach ($linkeditems as $type => $tab) {
                                 foreach ($tab as $ID) {
                                     $nb += countElementsInTable('glpi_items_projects', " `itemtype` = '{$type}'\n                                                            AND `items_id` = '{$ID}'");
                                 }
                             }
                         }
                     }
                     return self::createTabEntry(Project::getTypeName(Session::getPluralNumber()), $nb);
                 }
         }
     }
     return '';
 }
开发者ID:btry,项目名称:glpi,代码行数:32,代码来源:item_project.class.php


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