本文整理汇总了PHP中CTask类的典型用法代码示例。如果您正苦于以下问题:PHP CTask类的具体用法?PHP CTask怎么用?PHP CTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: taskstyle_pd
function taskstyle_pd($task)
{
$now = new CDate();
$start_date = intval($task["task_start_date"]) ? new CDate($task["task_start_date"]) : null;
$end_date = intval($task["task_end_date"]) ? new CDate($task["task_end_date"]) : null;
if ($start_date && !$end_date) {
$end_date = $start_date;
$end_date->addSeconds(@$task["task_duration"] * $task["task_duration_type"] * SEC_HOUR);
} else {
if (!$start_date) {
return '';
}
}
$style = 'class=';
if ($task['task_percent_complete'] == 0) {
$style .= $now->before($start_date) ? '"task_future"' : '"task_notstarted"';
} else {
if ($task['task_percent_complete'] == 100) {
$t = new CTask();
$t->load($task['task_id']);
$actual_end_date = new CDate(get_actual_end_date_pd($t->task_id, $t));
$style .= $actual_end_date->after($end_date) ? '"task_late"' : '"task_done"';
} else {
$style .= $now->after($end_date) ? '"task_overdue"' : '"task_started"';
}
}
return $style;
}
示例2: getProjectTaskLinksByCategory
public function getProjectTaskLinksByCategory($AppUI, $project_id = 0, $task_id = 0, $category_id = 0, $search = '')
{
// load the following classes to retrieved denied records
$project = new CProject();
$task = new CTask();
// SETUP FOR LINK LIST
$q = new DBQuery();
$q->addQuery('links.*');
$q->addQuery('contact_first_name, contact_last_name');
$q->addQuery('project_name, project_color_identifier, project_status');
$q->addQuery('task_name, task_id');
$q->addTable('links');
$q->leftJoin('users', 'u', 'user_id = link_owner');
$q->leftJoin('contacts', 'c', 'user_contact = contact_id');
if ($search != '') {
$q->addWhere('(link_name LIKE \'%' . $search . '%\' OR link_description LIKE \'%' . $search . '%\')');
}
if ($project_id > 0) {
// Project
$q->addWhere('link_project = ' . (int) $project_id);
}
if ($task_id > 0) {
// Task
$q->addWhere('link_task = ' . (int) $task_id);
}
if ($category_id >= 0) {
// Category
$q->addWhere('link_category = ' . $category_id);
}
// Permissions
$project->setAllowedSQL($AppUI->user_id, $q, 'link_project');
$task->setAllowedSQL($AppUI->user_id, $q, 'link_task and task_project = link_project');
$q->addOrder('project_name, link_name');
return $q->loadList();
}
示例3: setComplete
function setComplete($id)
{
global $AppUI;
$task = new CTask();
if ($task->load($id)) {
$q = new DBQuery();
$q->addTable('user_tasks');
$q->addQuery('user_id');
$q->addWhere('task_id = ' . $id);
$q->addWhere('user_id = ' . $AppUI->user_id);
$r = $q->loadResult();
if ($r != $AppUI->user_id) {
$p = new CProject($task->task_project);
if (!$p->project_id || $p->getManager() != $AppUI->user_id) {
return 'Error';
}
}
$q->addTable('tasks');
$q->addUpdate('task_percent_complete', '100');
$q->addWhere('task_id = ' . $id);
$q->exec();
return 'OK';
}
return 'Error';
}
示例4: GetOperations
public static function GetOperations($collectionId, $menu = false)
{
global $USER;
static $oCollections;
static $arOp;
$userGroups = $USER->GetUserGroupArray();
$key = $collectionId . '|' . implode('-', $userGroups);
if (!is_array($arOp[$key])) {
if (!is_array($arOp)) {
$arOp = array();
}
if (!is_array($oCollections)) {
$res = CMedialib::GetCollectionTree(array('menu' => $menu));
$oCollections = $res['Collections'];
}
$userGroups = $USER->GetUserGroupArray();
$res = CMedialib::GetAccessPermissionsArray($collectionId, $oCollections);
$arOp[$key] = array();
foreach ($res as $group_id => $task_id) {
if (in_array($group_id, $userGroups)) {
$arOp[$key] = array_merge($arOp[$key], CTask::GetOperations($task_id, true));
}
}
}
return $arOp[$key];
}
示例5: GetTasks
function GetTasks()
{
$arTasks = Array();
$res = CTask::GetList(Array('LETTER' => 'asc'), Array('MODULE_ID' => 'fileman', 'BINDING' => 'stickers'));
while($arRes = $res->Fetch())
{
$name = '';
if ($arRes['SYS'])
$name = GetMessage('TASK_NAME_'.strtoupper($arRes['NAME']));
if (strlen($name) == 0)
$name = $arRes['NAME'];
$arTasks[$arRes['ID']] = Array('title' => $name, 'letter' => $arRes['LETTER']);
}
return $arTasks;
}
示例6: getProjectTaskLinksByCategory
public function getProjectTaskLinksByCategory($notUsed = null, $project_id = 0, $task_id = 0, $category_id = 0, $search = '')
{
// load the following classes to retrieved denied records
$project = new CProject();
$project->overrideDatabase($this->_query);
$task = new CTask();
$task->overrideDatabase($this->_query);
// SETUP FOR LINK LIST
$q = $this->_getQuery();
$q->addQuery('links.*');
$q->addTable('links');
$q->leftJoin('projects', 'pr', 'project_id = link_project');
$q->leftJoin('tasks', 't', 'task_id = link_task');
if ($search != '') {
$q->addWhere('(link_name LIKE \'%' . $search . '%\' OR link_description LIKE \'%' . $search . '%\')');
}
if ($project_id > 0) {
// Project
$q->addQuery('project_name, project_color_identifier, project_status');
$q->addWhere('link_project = ' . (int) $project_id);
}
if ($task_id > 0) {
// Task
$q->addQuery('task_name, task_id');
$q->addWhere('link_task = ' . (int) $task_id);
}
if ($category_id >= 0) {
// Category
$q->addWhere('link_category = ' . $category_id);
}
// Permissions
$q = $project->setAllowedSQL($this->_AppUI->user_id, $q, 'link_project');
$q = $task->setAllowedSQL($this->_AppUI->user_id, $q, 'link_task and task_project = link_project');
$q->addOrder('project_name, link_name');
return $q->loadList();
}
示例7: GetTasks
function GetTasks()
{
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/fileman/admin/task_description.php");
$arTasks = array();
$res = CTask::GetList(array('LETTER' => 'asc'), array('MODULE_ID' => 'fileman', 'BINDING' => 'stickers'));
while ($arRes = $res->Fetch()) {
$name = '';
if ($arRes['SYS']) {
$name = GetMessage('TASK_NAME_' . strtoupper($arRes['NAME']));
}
if (strlen($name) == 0) {
$name = $arRes['NAME'];
}
$arTasks[$arRes['ID']] = array('title' => $name, 'letter' => $arRes['LETTER']);
}
return $arTasks;
}
示例8: w2p_Database_Query
$gantt->addBar($columnValues, ' ', 0.6, 'red');
} else {
if (is_array($projects)) {
//pull all tasks into an array keyed by the project id, and get the tasks in hierarchy
if ($showAllGantt) {
// insert tasks into Gantt Chart
// select for tasks for each project
// pull tasks
$q = new w2p_Database_Query();
$q->addTable('tasks', 't');
$q->addQuery('t.task_id, task_parent, task_name, task_start_date, task_end_date, task_duration, task_duration_type, task_priority, task_percent_complete, task_order, task_project, task_milestone, project_id, project_name, task_dynamic');
$q->addJoin('projects', 'p', 'project_id = t.task_project');
$q->addOrder('project_id, task_start_date');
$q->addWhere('project_original_parent = ' . (int) $original_project_id);
//$tasks = $q->loadList();
$task = new CTask();
$task->setAllowedSQL($AppUI->user_id, $q);
$proTasks = $q->loadHashList('task_id');
$orrarr[] = array('task_id' => 0, 'order_up' => 0, 'order' => '');
$end_max = '0000-00-00 00:00:00';
$start_min = date('Y-m-d H:i:s');
//pull the tasks into an array
foreach ($proTasks as $rec) {
if ($rec['task_start_date'] == '0000-00-00 00:00:00') {
$rec['task_start_date'] = date('Y-m-d H:i:s');
}
$tsd = new w2p_Utilities_Date($rec['task_start_date']);
if ($tsd->before(new w2p_Utilities_Date($start_min))) {
$start_min = $rec['task_start_date'];
}
// calculate or set blank task_end_date if unset
示例9: CProject
$q->addQuery('t.*');
$q->addJoin('projects', '', 'projects.project_id = task_project', 'inner');
$q->addJoin('project_departments', '', 'project_departments.project_id = projects.project_id');
$q->addJoin('departments', '', 'department_id = dept_id');
$q->addWhere('project_active = 1');
if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
$q->addWhere('project_status <> ' . (int) $template_status);
}
if ($use_period) {
$q->addWhere('( (task_start_date >= ' . $ss . ' AND task_start_date <= ' . $se . ') OR ' . '(task_end_date <= ' . $se . ' AND task_end_date >= ' . $ss . ') )');
}
if ($project_id != 0) {
$q->addWhere('task_project=' . $project_id);
}
$proj = new CProject();
$obj = new CTask();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'task_project');
$allowedTasks = $obj->getAllowedSQL($AppUI->user_id);
if (count($allowedProjects)) {
$q->addWhere(implode(' AND ', $allowedProjects));
}
if (count($allowedTasks)) {
$q->addWhere(implode(' AND ', $allowedTasks));
}
$q->addOrder('task_end_date');
$task_list_hash = $q->loadHashList('task_id');
$q->clear();
$task_list = array();
$task_assigned_users = array();
$i = 0;
foreach ($task_list_hash as $task_id => $task_data) {
示例10: substr
if ($rcode == "ER") {
$errorMessage .= substr($responseBody, 2) . "<br />";
} elseif ($rcode != "OK") {
$errorMessage .= GetMessage("SPTEN_SCRM_ERR_ANSWER") . "<br />";
} else {
$crmUrl4Import = trim(substr($responseBody, 2));
}
}
}
if (empty($errorMessage)) {
if ($createNewSaleUser) {
$APPLICATION->SetGroupRight("sale", $groupId, "W", false);
//$APPLICATION->SetGroupRight("catalog", $groupId, "R", false);
CGroup::SetModulePermission($groupId, "catalog", CTask::GetIdByLetter("R", "catalog"));
//$APPLICATION->SetGroupRight("main", $groupId, "R", false);
CGroup::SetModulePermission($groupId, "main", CTask::GetIdByLetter("R", "main"));
$opt = COption::GetOptionString("sale", "1C_SALE_GROUP_PERMISSIONS", "");
$opt .= ($opt != "" ? "," : "") . $groupId;
COption::SetOptionString("sale", "1C_SALE_GROUP_PERMISSIONS", $opt);
function GetAccessArrTmp()
{
$PERM = array();
@(include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/.access.php");
return $PERM;
}
$arFPermsTmp = GetAccessArrTmp();
$arFPerms = array_key_exists("admin", $arFPermsTmp) ? $arFPermsTmp["admin"] : array();
$arFPerms[$groupId . ""] = "R";
$APPLICATION->SetFileAccessPermission(array(SITE_ID, "/bitrix/admin"), $arFPerms);
}
LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&success=Y&crm_imp_url=" . urlencode(($crmUrlScheme == 'ssl://' ? "https" : "http") . "://" . $crmUrlHost . ":" . $crmUrlPort . $crmUrl4Import) . "&crm_url=" . urlencode(($crmUrlScheme == 'ssl://' ? "https" : "http") . "://" . $crmUrlHost . ":" . $crmUrlPort));
示例11: array
// prepare a list of tasks to process
$htasks_ar = array();
if (isset($htasks)) {
$tarr = explode(',', $htasks);
foreach ($tarr as $tid) {
if (intval($tid) > 0) {
$htasks_ar[] = $tid;
}
}
}
$sizeof = sizeof($htasks_ar);
for ($i = 0; $i <= $sizeof; $i++) {
$_POST['task_id'] = $htasks_ar[$i];
// verify that task_id is not NULL
if ($_POST['task_id'] > 0) {
$obj = new CTask();
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
if ($rm && $del) {
$overAssignment = $obj->updateAssigned($hassign, $hperc_assign_ar, true, true);
if ($overAssignment) {
$AppUI->setMsg('Some Users could not be unassigned from Task', UI_MSG_ERROR);
} else {
// Don't do anything because we might have other tasks to change
// $AppUI->setMsg('User(s) unassigned from Task', UI_MSG_OK);
// $AppUI->redirect();
}
} else {
if ($rm || $del) {
示例12: getTaskLinks
/**
* Sub-function to collect tasks within a period
*
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @param int the company id to filter by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0)
{
global $a, $AppUI, $dPconfig;
$tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, $AppUI->user_id, true);
$durnTypes = dPgetSysVal('TaskDurationType');
$link = array();
$sid = 3600 * 24;
// assemble the links for the tasks
foreach ($tasks as $row) {
// the link
$link['href'] = "?m=tasks&a=view&task_id=" . $row['task_id'];
$link['alt'] = $row['project_name'] . ":\n" . $row['task_name'];
// the link text
if (strlen($row['task_name']) > $strMaxLen) {
$row['task_name'] = substr($row['task_name'], 0, $strMaxLen) . '...';
}
$link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['task_name'] . '</span>';
// determine which day(s) to display the task
$start = new CDate($row['task_start_date']);
$end = $row['task_end_date'] ? new CDate($row['task_end_date']) : null;
$durn = $row['task_duration'];
$durnType = $row['task_duration_type'];
if (($start->after($startPeriod) || $start->equals($startPeriod)) && ($start->before($endPeriod) || $start->equals($endPeriod))) {
$temp = $link;
$temp['alt'] = "START [" . $row['task_duration'] . ' ' . $AppUI->_($durnTypes[$row['task_duration_type']]) . "]\n" . $link['alt'];
if ($a != 'day_view') {
$temp['text'] = dPshowImage(dPfindImage('block-start-16.png')) . $temp['text'];
}
$links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp;
}
if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) {
$temp = $link;
$temp['alt'] = "FINISH\n" . $link['alt'];
if ($a != 'day_view') {
$temp['text'] .= dPshowImage(dPfindImage('block-end-16.png'));
}
$links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
}
// convert duration to days
if ($durnType < 24.0) {
if ($durn > $dPconfig['daily_working_hours']) {
$durn /= $dPconfig['daily_working_hours'];
} else {
$durn = 0.0;
}
} else {
$durn *= $durnType / 24.0;
}
// fill in between start and finish based on duration
// notes:
// start date is not in a future month, must be this or past month
// start date is counted as one days work
// business days are not taken into account
$target = $start;
$target->addSeconds($durn * $sid);
if (Date::compare($target, $startPeriod) < 0) {
continue;
}
if (Date::compare($start, $startPeriod) > 0) {
$temp = $start;
$temp->addSeconds($sid);
} else {
$temp = $startPeriod;
}
// Optimised for speed, AJD.
while (Date::compare($endPeriod, $temp) > 0 && Date::compare($target, $temp) > 0 && ($end == null || $temp->before($end))) {
$links[$temp->format(FMT_TIMESTAMP_DATE)][] = $link;
$temp->addSeconds($sid);
}
}
}
示例13: taskstyle_pd
$q->addWhere('task_parent = ' . (int) $row['task_id']);
$q->addWhere('task_id <> task_parent');
$row['children'] = $q->loadResult();
$row['style'] = taskstyle_pd($row);
$i = count($projects[$row['task_project']]['tasks']) + 1;
$row['task_number'] = $i;
$row['node_id'] = 'node_' . $i . '-' . $row['task_id'];
if (strpos($row['task_duration'], '.') && $row['task_duration_type'] == 1) {
$row['task_duration'] = floor($row['task_duration']) . ':' . round(60 * ($row['task_duration'] - floor($row['task_duration'])));
}
//pull the final task row into array
$projects[$row['task_project']]['tasks'][] = $row;
}
$showEditCheckbox = isset($canEditTasks) && $canEditTasks || $perms->checkModule('admin', 'view');
$durnTypes = w2PgetSysVal('TaskDurationType');
$tempoTask = new CTask();
$userAlloc = $tempoTask->getAllocation('user_id');
?>
<table width="100%" border="0" cellpadding="1" cellspacing="3" class="prjprint">
<tr class="prjprint">
<th width="50%"><?php
echo $AppUI->_('Task Name');
?>
</th>
<th width="50" nowrap="nowrap"><?php
echo $AppUI->_('Work');
?>
</th>
<th nowrap="nowrap"><?php
echo $AppUI->_('Start');
?>
示例14: strtolower
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
global $DBType;
require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . strtolower($DBType) . "/favorites.php";
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
//Change site name
$obSite = new CSite();
$obSite->Update("s1", array("NAME" => COption::GetOptionString("main", "site_name", GetMessage("DEFAULT_SITE_NAME"))));
//Edit profile task
$editProfileTask = false;
$dbResult = CTask::GetList(array(), array("NAME" => "main_change_profile"));
if ($arTask = $dbResult->Fetch()) {
$editProfileTask = $arTask["ID"];
}
//admin security policy
$z = CGroup::GetByID(1);
if ($res = $z->Fetch()) {
if ($res["SECURITY_POLICY"] == "") {
$group = new CGroup();
$arGroupPolicy = array("SESSION_TIMEOUT" => 15, "SESSION_IP_MASK" => "255.255.255.255", "MAX_STORE_NUM" => 1, "STORE_IP_MASK" => "255.255.255.255", "STORE_TIMEOUT" => 60 * 24 * 3, "CHECKWORD_TIMEOUT" => 60, "PASSWORD_LENGTH" => 10, "PASSWORD_UPPERCASE" => "Y", "PASSWORD_LOWERCASE" => "Y", "PASSWORD_DIGITS" => "Y", "PASSWORD_PUNCTUATION" => "Y", "LOGIN_ATTEMPTS" => 3);
$arFields = array("SECURITY_POLICY" => serialize($arGroupPolicy));
$group->Update(1, $arFields);
}
}
//Registered users group
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($dbResult->Fetch()) {
return;
示例15: array
$userGroupID = "";
$dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "content_editor"));
if ($arGroup = $dbGroup->Fetch()) {
$userGroupID = $arGroup["ID"];
} else {
$group = new CGroup();
$arFields = array("ACTIVE" => "Y", "C_SORT" => 300, "NAME" => GetMessage("SALE_WIZARD_CONTENT_EDITOR"), "DESCRIPTION" => GetMessage("SALE_WIZARD_CONTENT_EDITOR_DESCR"), "USER_ID" => array(), "STRING_ID" => "content_editor");
$userGroupID = $group->Add($arFields);
$DB->Query("INSERT INTO b_sticker_group_task(GROUP_ID, TASK_ID)\tSELECT " . intVal($userGroupID) . ", ID FROM b_task WHERE NAME='stickers_edit' AND MODULE_ID='fileman'", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
if (IntVal($userGroupID) > 0) {
WizardServices::SetFilePermission(array($siteID, "/bitrix/admin"), array($userGroupID => "R"));
$rsTasks = CTask::GetList(array(), array("MODULE_ID" => "main", "SYS" => "Y", "BINDIG" => "module", "LETTER" => "P"));
if ($arTask = $rsTasks->Fetch()) {
CGroup::SetModulePermission($userGroupID, $arTask["MODULE_ID"], $arTask["ID"]);
}
$rsTasks = CTask::GetList(array(), array("MODULE_ID" => "fileman", "SYS" => "Y", "BINDIG" => "module", "LETTER" => "F"));
if ($arTask = $rsTasks->Fetch()) {
CGroup::SetModulePermission($userGroupID, $arTask["MODULE_ID"], $arTask["ID"]);
}
$SiteDir = "";
if (WIZARD_SITE_ID != "s1") {
$SiteDir = "/site_" . WIZARD_SITE_ID;
}
WizardServices::SetFilePermission(array($siteID, $SiteDir . "/index.php"), array($userGroupID => "W"));
WizardServices::SetFilePermission(array($siteID, $SiteDir . "/about/"), array($userGroupID => "W"));
WizardServices::SetFilePermission(array($siteID, $SiteDir . "/news/"), array($userGroupID => "W"));
WizardServices::SetFilePermission(array($siteID, $SiteDir . "/catalog/"), array($userGroupID => "W"));
WizardServices::SetFilePermission(array($siteID, $SiteDir . "/personal/"), array($userGroupID => "W"));
}
COption::SetOptionString("eshop", "wizard_installed", "Y", false, WIZARD_SITE_ID);