public function getState() { $state = new ProjectState($this->getStateId()); return $state->getName(); }
/** * Print the Project task form * * @param $ID integer Id of the project task * @param $options array of possible options: * - target form target * - projects_id ID of the software for add process * * @return true if displayed false if item not found or not right to display **/ function showForm($ID, $options = array()) { global $CFG_GLPI; if ($ID > 0) { $this->check($ID, READ); $projects_id = $this->fields['projects_id']; $projecttasks_id = $this->fields['projecttasks_id']; } else { $projects_id = $options['projects_id']; $projecttasks_id = $options['projecttasks_id']; $this->check(-1, CREATE, $options); } $this->showFormHeader($options); echo "<tr class='tab_bg_1'><td>" . _n('Project', 'Projects', Session::getPluralNumber()) . "</td>"; echo "<td>"; if ($this->isNewID($ID)) { echo "<input type='hidden' name='projects_id' value='{$projects_id}'>"; } echo "<a href='project.form.php?id=" . $projects_id . "'>" . Dropdown::getDropdownName("glpi_projects", $projects_id) . "</a>"; echo "</td>"; echo "<td>" . __('As child of') . "</td>"; echo "<td>"; $this->dropdown(array('entity' => $this->fields['entities_id'], 'value' => $projecttasks_id, 'condition' => "`glpi_projecttasks`.`projects_id`='" . $this->fields['projects_id'] . "'", 'used' => array($this->fields['id']))); echo "</td></tr>"; $showuserlink = 0; if (Session::haveRight('user', READ)) { $showuserlink = 1; } if ($ID) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Creation date') . "</td>"; echo "<td>"; echo sprintf(__('%1$s by %2$s'), Html::convDateTime($this->fields["date"]), getUserName($this->fields["users_id"], $showuserlink)); echo "</td>"; echo "<td>" . __('Last update') . "</td>"; echo "<td>"; echo Html::convDateTime($this->fields["date_mod"]); echo "</td></tr>"; } echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>"; echo "<td colspan='3'>"; Html::autocompletionTextField($this, "name", array('size' => 80)); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _x('item', 'State') . "</td>"; echo "<td>"; ProjectState::dropdown(array('value' => $this->fields["projectstates_id"])); echo "</td>"; echo "<td>" . __('Type') . "</td>"; echo "<td>"; ProjectTaskType::dropdown(array('value' => $this->fields["projecttasktypes_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Percent done') . "</td>"; echo "<td>"; Dropdown::showNumber("percent_done", array('value' => $this->fields['percent_done'], 'min' => 0, 'max' => 100, 'step' => 5, 'unit' => '%')); echo "</td>"; echo "<td>"; _e('Milestone'); echo "</td>"; echo "<td>"; Dropdown::showYesNo("is_milestone", $this->fields["is_milestone"]); echo "</td>"; echo "</tr>"; echo "<tr><td colspan='4' class='subheader'>" . __('Planning') . "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Planned start date') . "</td>"; echo "<td>"; Html::showDateTimeField("plan_start_date", array('value' => $this->fields['plan_start_date'])); echo "</td>"; echo "<td>" . __('Real start date') . "</td>"; echo "<td>"; Html::showDateTimeField("real_start_date", array('value' => $this->fields['real_start_date'])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Planned end date') . "</td>"; echo "<td>"; Html::showDateTimeField("plan_end_date", array('value' => $this->fields['plan_end_date'])); echo "</td>"; echo "<td>" . __('Real end date') . "</td>"; echo "<td>"; Html::showDateTimeField("real_end_date", array('value' => $this->fields['real_end_date'])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Planned duration') . "</td>"; echo "<td>"; Dropdown::showTimeStamp("planned_duration", array('min' => 0, 'max' => 100 * HOUR_TIMESTAMP, 'step' => HOUR_TIMESTAMP, 'value' => $this->fields["planned_duration"], 'addfirstminutes' => true, 'inhours' => true)); echo "</td>"; echo "<td>" . __('Effective duration') . "</td>"; echo "<td>"; Dropdown::showTimeStamp("effective_duration", array('min' => 0, 'max' => 100 * HOUR_TIMESTAMP, 'step' => HOUR_TIMESTAMP, 'value' => $this->fields["effective_duration"], 'addfirstminutes' => true, 'inhours' => true)); if ($ID) { $ticket_duration = ProjectTask_Ticket::getTicketsTotalActionTime($this->getID()); echo "<br>"; printf(__('%1$s: %2$s'), __('Tickets duration'), Html::timestampToString($ticket_duration, false)); echo '<br>'; printf(__('%1$s: %2$s'), __('Total duration'), Html::timestampToString($ticket_duration + $this->fields["effective_duration"], false)); } echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Description') . "</td>"; echo "<td colspan='3'>"; echo "<textarea id='content' name='content' cols='90' rows='6'>" . $this->fields["content"] . "</textarea>"; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Comments') . "</td>"; echo "<td colspan='3'>"; echo "<textarea id='comment' name='comment' cols='90' rows='6'>" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>\n"; $this->showFormButtons($options); return true; }
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 Absmaster. If not, see <http://www.gnu.org/licenses/>. */ require_once "local_env.php"; require_once "global_functions.php"; require_once "ProjectState.php"; require_once "UserInventory.php"; // Set these project variables and run this file as `php init_new_project.php` to initialize Absmaster $PROJECT_NAME = 'Fall Seminar Abstracts'; $ADMIN_EMAIL = '*****@*****.**'; $ADMIN_PIN = '123456'; if (file_exists(PROJECT_STATE_FILE) || file_exists(USERS_FILE)) { die("This project already seems to be initiated; data files exist.\n"); } if (filter_var($ADMIN_EMAIL, FILTER_VALIDATE_EMAIL) == false) { die("Please use a valid email address for the admin email.\n"); } if (is_numeric($ADMIN_PIN) == false) { die("Please choose a numerical admin pin.\n"); } $initiated_project = new ProjectState(PROJECT_STATE_FILE); $initiated_project->set_project_name($PROJECT_NAME); $initiated_project->set_admin_email($ADMIN_EMAIL); $initiated_project->set_admin_pin($ADMIN_PIN); $initiated_project->write_project_state_data(); $initiated_user_inventory = new UserInventory(USERS_FILE); $initiated_user_inventory->write_user_data(); echo "Project \"{$PROJECT_NAME}\" has now been initialized with admin email \"{$ADMIN_EMAIL}\" and admin PIN \"{$ADMIN_PIN}\".\n";
/** * Print the computer form * * @param $ID integer ID of the item * @param $options array * - target for the Form * - withtemplate template or basic computer * *@return Nothing (display) **/ function showForm($ID, $options = array()) { global $CFG_GLPI, $DB; $this->initForm($ID, $options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Creation date') . "</td>"; echo "<td>"; $date = $this->fields["date"]; if (!$ID) { $date = $_SESSION['glpi_currenttime']; } Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false)); echo "</td>"; if ($ID) { echo "<td>" . __('Last update') . "</td>"; echo "<td >" . Html::convDateTime($this->fields["date_mod"]) . "</td>"; } else { echo "<td colspan='2'> </td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, 'name'); echo "</td>"; echo "<td>" . __('Code') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, 'code'); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Priority') . "</td>"; echo "<td>"; CommonITILObject::dropdownPriority(array('value' => $this->fields['priority'], 'withmajor' => 1)); echo "</td>"; echo "<td>" . __('As child of') . "</td>"; echo "<td>"; $this->dropdown(array('entity' => $this->fields['entities_id'], 'value' => $this->fields['projects_id'], 'used' => array($this->fields['id']))); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _x('item', 'State') . "</td>"; echo "<td>"; ProjectState::dropdown(array('value' => $this->fields["projectstates_id"])); echo "</td>"; echo "<td>" . __('Percent done') . "</td>"; echo "<td>"; Dropdown::showNumber("percent_done", array('value' => $this->fields['percent_done'], 'min' => 0, 'max' => 100, 'step' => 5, 'unit' => '%')); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Type') . "</td>"; echo "<td>"; ProjectType::dropdown(array('value' => $this->fields["projecttypes_id"])); echo "</td>"; echo "<td>" . __('Show on global GANTT') . "</td>"; echo "<td>"; Dropdown::showYesNo("show_on_global_gantt", $this->fields["show_on_global_gantt"]); echo "</td>"; echo "</tr>"; echo "<tr><td colspan='4' class='subheader'>" . __('Manager') . "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('User') . "</td>"; echo "<td>"; User::dropdown(array('name' => 'users_id', 'value' => $this->fields["users_id"], 'right' => 'see_project', 'entity' => $this->fields["entities_id"])); echo "</td>"; echo "<td>" . __('Group') . "</td>"; echo "<td>"; Group::dropdown(array('name' => 'groups_id', 'value' => $this->fields['groups_id'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_manager`')); echo "</td></tr>\n"; echo "<tr><td colspan='4' class='subheader'>" . __('Planning') . "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Planned start date') . "</td>"; echo "<td>"; Html::showDateTimeField("plan_start_date", array('value' => $this->fields['plan_start_date'])); echo "</td>"; echo "<td>" . __('Real start date') . "</td>"; echo "<td>"; Html::showDateTimeField("real_start_date", array('value' => $this->fields['real_start_date'])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Planned end date') . "</td>"; echo "<td>"; Html::showDateTimeField("plan_end_date", array('value' => $this->fields['plan_end_date'])); echo "</td>"; echo "<td>" . __('Real end date') . "</td>"; echo "<td>"; Html::showDateTimeField("real_end_date", array('value' => $this->fields['real_end_date'])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Planned duration'); echo Html::showTooltip(__('Sum of planned durations of tasks')); echo "</td>"; echo "<td>"; echo Html::timestampToString(ProjectTask::getTotalPlannedDurationForProject($this->fields['id']), false); echo "</td>"; echo "<td>" . __('Effective duration'); echo Html::showTooltip(__('Sum of total effective durations of tasks')); echo "</td>"; echo "<td>"; echo Html::timestampToString(ProjectTask::getTotalEffectiveDurationForProject($this->fields['id']), false); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Description') . "</td>"; echo "<td colspan='3'>"; echo "<textarea id='content' name='content' cols='90' rows='6'>" . $this->fields["content"] . "</textarea>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Comments') . "</td>"; echo "<td colspan='3'>"; echo "<textarea id='comment' name='comment' cols='90' rows='6'>" . $this->fields["comment"] . "</textarea>"; echo "</td>"; echo "</tr>\n"; $this->showFormButtons($options); return true; }
/* This file is part of Absmaster. Absmaster 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 3 of the License, or (at your option) any later version. Absmaster 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 Absmaster. If not, see <http://www.gnu.org/licenses/>. */ require_once "local_env.php"; require_once "global_functions.php"; require_once "UserInventory.php"; require_once "User.php"; require_once "ProjectState.php"; require_once "reviews.php"; if (!file_exists(USERS_FILE) || !file_exists(PROJECT_STATE_FILE)) { die("This Absmaster installation/project has not been initiated!\n"); } //UserInventory setup $USERINVENTORY = new UserInventory(USERS_FILE); $USERINVENTORY->read_user_data(); //ProjectState setup $PROJECTSTATE = new ProjectState(PROJECT_STATE_FILE); $PROJECTSTATE->read_project_state_data();