本文整理汇总了PHP中Project::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::fetch方法的具体用法?PHP Project::fetch怎么用?PHP Project::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Project
/**
* Output a combo list with projects qualified for a third party
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id project preselected
* @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode
* @param string $filterkey Key to filter
* @return int Nber of project if OK, <0 if KO
*/
function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '')
{
global $langs, $conf, $form;
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
$placeholder = '';
if ($selected && empty($selected_input_value)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$project = new Project($this->db);
$project->fetch($selected);
$selected_input_value = $project->ref;
}
$urloption = 'socid=' . $socid . '&htmlname=' . $htmlname;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array());
print '<input type="text" size="20" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' />';
} else {
print $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey);
if ($discard_closed) {
if (class_exists('Form')) {
if (empty($form)) {
$form = new Form($this->db);
}
print $form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden"));
}
}
}
}
示例2: handleRequest
protected function handleRequest(array $request)
{
$projectId = $request[self::FIELD_PROJECT_ID];
$project = Project::fetch($projectId);
// FIXME: global::lock()
Project::erase($projectId);
Project::shiftLeft($project->getOrd());
}
示例3: handleRequest
protected function handleRequest(array $request)
{
$projectId = $request[self::FIELD_PROJECT_ID];
$project = Project::fetch($projectId);
$lists = TasksList::fetchAllInProject($projectId);
$listsRep = array();
foreach ($lists as $list) {
$tasks = Task::fetchAllInList($list->getId());
$tasksRep = array();
foreach ($tasks as $task) {
$tasksRep[] = array(self::FIELD_TITLE => $task->getTitle(), self::FIELD_DESCRIPTION => $task->getDescription(), self::FIELD_TASK_STATUS => $task->getStatus());
}
$listsRep[] = array(self::FIELD_TITLE => $list->getTitle(), self::FIELD_TASKS => $tasksRep);
}
return array(self::FIELD_PROTOCOL_VERSION => self::CURRENT_PROTOCOL_VERSION, self::FIELD_TITLE => $project->getTitle(), self::FIELD_DESCRIPTION => $project->getDescription(), self::FIELD_LISTS => $listsRep);
}
示例4: handleRequest
protected function handleRequest(array $request)
{
$beforeId = $request[self::FIELD_BEFORE_PROJECT_ID];
$title = $request[self::FIELD_TITLE];
$description = $request[self::FIELD_DESCRIPTION];
// FIXME: Global::lock();
$ord = null;
if ($beforeId) {
$beforeProject = Project::fetch($beforeId);
$ord = $beforeProject->getOrd();
Project::shiftRight($ord);
} else {
$ord = Project::getNextOrd();
}
$projectId = Project::create($ord, $title, $description);
return array(self::FIELD_PROJECT_ID => $projectId);
}
示例5: handleRequest
protected function handleRequest(array $request)
{
$projectId = $request[self::FIELD_PROJECT_ID];
$beforeProjectId = $request[self::FIELD_BEFORE_PROJECT_ID];
$project = Project::fetch($projectId);
// FIXME: Global::lock();
if ($beforeProjectId) {
Project::shiftLeft($project->getOrd());
if ($beforeProjectId === $projectId) {
throw new Exception("Can't move project before itself", EndPoint::STATUS_BAD_REQUEST);
}
$beforeProject = Project::fetch($beforeProjectId);
Project::shiftRight($beforeProject->getOrd());
Project::updateOrd($projectId, $beforeProject->getOrd());
} else {
Project::shiftLeft($project->getOrd());
Project::updateOrd($projectId, Project::getNextOrd());
}
}
示例6: handleRequest
protected function handleRequest(array $request)
{
$projectId = $request[self::FIELD_PROJECT_ID];
$excludeClosedTasks = $request[self::FIELD_EXCLUDE_CLOSED_TASKS];
$project = Project::fetch($projectId);
$lists = TasksList::fetchAllInProject($projectId);
$listsRep = array();
foreach ($lists as $list) {
$tasks = Task::fetchAllInList($list->getId());
$tasksRep = array();
foreach ($tasks as $task) {
if ($excludeClosedTasks && $task->getStatus() == Task::STATUS_CLOSED) {
continue;
}
$tasksRep[] = array(self::FIELD_TASK_ID => $task->getId(), self::FIELD_TITLE => $task->getTitle(), self::FIELD_DESCRIPTION => $task->getDescription(), self::FIELD_TASK_STATUS => $task->getStatus());
}
$listsRep[] = array(self::FIELD_LIST_ID => $list->getId(), self::FIELD_TITLE => $list->getTitle(), self::FIELD_TASKS => $tasksRep);
}
return array(self::FIELD_PROJECT_ID => $project->getId(), self::FIELD_TITLE => $project->getTitle(), self::FIELD_DESCRIPTION => $project->getDescription(), self::FIELD_LISTS => $listsRep);
}
示例7: scrum_getVelocity
function scrum_getVelocity(&$db, $id_project)
{
global $conf;
$n_day = $conf->global->SCRUM_VELOCITY_NUMBER_OF_DAY ? $conf->global->SCRUM_VELOCITY_NUMBER_OF_DAY : 14;
$t2week = strtotime('-' . $n_day . ' days');
$projet = new Project($db);
$projet->fetch($id_project);
if ($projet->date_start > $t2week) {
$t2week = $projet->date_start;
}
$res = $db->query("SELECT SUM(tt.task_duration) as task_duration \n\tFROM " . MAIN_DB_PREFIX . "projet_task_time tt LEFT JOIN " . MAIN_DB_PREFIX . "projet_task t ON (tt.fk_task=t.rowid)\n\tWHERE tt.task_date>='" . date('Y-m-d', $t2week) . "' AND t.fk_projet=" . $id_project);
$velocity = 0;
if ($obj = $db->fetch_object($res)) {
$velocity = round($obj->task_duration / ((time() - $t2week) / 86400));
}
if ($velocity == 0) {
$velocity = (int) $conf->global->SCRUM_DEFAULT_VELOCITY * 3600;
}
return $velocity;
}
示例8: get_format_libelle_projet
function get_format_libelle_projet($fk)
{
global $db;
if ($fk > 0) {
dol_include_once('/projet/class/project.class.php');
$o = new Project($db);
if ($o->fetch($fk) > 0) {
return $o->getNomUrl(1);
} else {
return $fk;
}
}
return '';
}
示例9: GETPOST
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$langs->load("users");
$langs->load("projects");
$action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$mode = GETPOST('mode', 'alpha');
$mine = $mode == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
$taskstatic = new Task($db);
$extrafields_project = new ExtraFields($db);
$extrafields_task = new ExtraFields($db);
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref);
$id = $object->id;
$ref = $object->ref;
// fetch optionals attributes and labels
$extralabels_projet = $extrafields_project->fetch_name_optionals_label($object->table_element);
$extralabels_task = $extrafields_task->fetch_name_optionals_label($taskstatic->table_element);
}
// Security check
$socid = 0;
if ($user->societe_id > 0) {
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'projet', $id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('projecttaskcard', 'globalcard'));
$progress = GETPOST('progress', 'int');
示例10: accessforbidden
<?php
require 'config.php';
dol_include_once('/projet/class/project.class.php');
dol_include_once('/core/lib/project.lib.php');
if (!$user->rights->mandarin->graph->project_task) {
accessforbidden();
}
$langs->load('mandarin@mandarin');
$progress_min = GETPOST('progress_min', 'int');
$progress_max = GETPOST('progress_max', 'int');
$id = GETPOST('id', 'int');
$object = new Project($db);
if ($id > 0) {
$object->fetch($id);
}
$PDOdb = new TPDOdb();
$TData = array();
$sql = 'SELECT pt.rowid, pt.label, pt.ref
, SUM(pt.planned_workload) AS temps_prevu
, SUM(pt.planned_workload * (pt.progress / 100)) AS temps_theorique
, SUM(ptt.task_duration) AS temps_reel
FROM ' . MAIN_DB_PREFIX . 'projet_task pt
LEFT JOIN ' . MAIN_DB_PREFIX . 'projet_task_time ptt ON (pt.rowid = ptt.fk_task)
WHERE pt.entity = ' . $conf->entity . '
AND pt.fk_projet = ' . $id;
if (!empty($progress_min)) {
$sql .= ' AND pt.progress >= ' . $progress_min;
}
if (!empty($progress_max)) {
$sql .= ' AND pt.progress >= ' . $progress_max;
示例11: GETPOST
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
$langs->load("projects");
$langs->load("companies");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'alpha');
$mine = GETPOST('mode') == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref);
$object->fetch_thirdparty();
$id = $object->id;
}
// Security check
$socid = 0;
if ($user->societe_id > 0) {
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'projet', $id);
/*
* Actions
*/
// Add new contact
if ($action == 'addcontact' && $user->rights->projet->creer) {
$result = 0;
示例12: GETPOST
$cancel = GETPOST('cancel', 'alpha');
$status = GETPOST('status', 'int');
$opp_status = GETPOST('opp_status', 'int');
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && !$_POST["cancel"])) {
accessforbidden();
}
$mine = GETPOST('mode') == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('projectcard', 'globalcard'));
$object = new Project($db);
$extrafields = new ExtraFields($db);
// Load object
//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Can't use generic include because when creating a project, ref is defined and we dont want error if fetch fails from ref.
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref);
// If we create project, ref may be defined into POST but record does not yet exists into database
if ($ret > 0) {
$object->fetch_thirdparty();
$id = $object->id;
}
}
// Security check
$socid = GETPOST('socid');
if ($user->societe_id > 0) {
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'projet', $object->id);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$date_start = dol_mktime(0, 0, 0, GETPOST('projectstartmonth', 'int'), GETPOST('projectstartday', 'int'), GETPOST('projectstartyear', 'int'));
示例13: Project
if ($object->contactid && $object->type_code == 'AC_TEL') {
if ($object->contact->fetch($object->contactid)) {
print "<br>" . dol_print_phone($object->contact->phone_pro);
}
}
} else {
print $langs->trans("None");
}
print '</td></tr>';
}
// Project
if (!empty($conf->projet->enabled)) {
print '<tr><td width="30%">' . $langs->trans("Project") . '</td><td colspan="3">';
if ($object->fk_project) {
$project = new Project($db);
$project->fetch($object->fk_project);
print $project->getNomUrl(1, '', 1);
}
print '</td></tr>';
}
// Priority
print '<tr><td class="nowrap" width="30%">' . $langs->trans("Priority") . '</td><td colspan="3">';
print $object->priority ? $object->priority : '';
print '</td></tr>';
// Object linked
if (!empty($object->fk_element) && !empty($object->elementtype)) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
print '<tr><td>' . $langs->trans("LinkedObject") . '</td>';
print '<td colspan="3">' . dolGetElementUrl($object->fk_element, $object->elementtype, 1) . '</td></tr>';
}
// Description
示例14: Task
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "name";
}
$object = new Task($db);
$projectstatic = new Project($db);
/*
* Actions
*/
// Retreive First Task ID of Project if withprojet is on to allow project prev next to work
if (!empty($project_ref) && !empty($withproject)) {
if ($projectstatic->fetch(0, $project_ref) > 0) {
$tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
if (count($tasksarray) > 0) {
$id = $tasksarray[0]->id;
$object->fetch($id);
} else {
header("Location: " . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . ($withproject ? '&withproject=1' : '') . (empty($mode) ? '' : '&mode=' . $mode));
exit;
}
}
}
if ($id > 0 || !empty($ref)) {
if ($object->fetch($id, $ref) > 0) {
$projectstatic->fetch($object->fk_project);
if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
示例15: setEventMessages
if ($ret < 0) {
$error++;
}
if (!$error) {
$result = $object->update($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} else {
$action = 'edit';
}
}
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->supprimer) {
if ($object->fetch($id, $ref) >= 0) {
$result = $projectstatic->fetch($object->fk_project);
$projectstatic->fetch_thirdparty();
if ($object->delete($user) > 0) {
header('Location: ' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . ($withproject ? '&withproject=1' : ''));
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
}
// Retreive First Task ID of Project if withprojet is on to allow project prev next to work
if (!empty($project_ref) && !empty($withproject)) {
if ($projectstatic->fetch('', $project_ref) > 0) {
$tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
if (count($tasksarray) > 0) {