本文整理汇总了PHP中CTask::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP CTask::bind方法的具体用法?PHP CTask::bind怎么用?PHP CTask::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTask
的用法示例。
在下文中一共展示了CTask::bind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$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) {
$task = new CTask();
$task->bind($task_data);
$task_list[$i] = $task;
$task_assigned_users[$i] = $task->assignees($task_id);
$i++;
}
$Ntasks = $i;
$user_usage = array();
$task_dates = array();
$actual_date = $start_date;
$days_header = "";
// we will save days title here
if (strtolower($max_levels) == 'max') {
$max_levels = -1;
} elseif ($max_levels == '') {
$max_levels = -1;
} else {
示例2: array
$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) {
if ($msg = $obj->removeAssigned($user_id)) {
示例3: dprint
} else {
dprint(__FILE__, __LINE__, 2, 'No pre_save functions.');
}
// Find the task if we are set
$task_end_date = null;
if ($task_id) {
$obj->load($task_id);
$task_end_date = new CDate($obj->task_end_date);
}
if ($_POST['task_start_date'] === '') {
$_POST['task_start_date'] = '000000000000';
}
if ($_POST['task_end_date'] === '') {
$_POST['task_end_date'] = '000000000000';
}
if (isset($_POST) && !$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
if (!$obj->task_owner) {
$obj->task_owner = $AppUI->user_id;
}
// Check to see if the task_project has changed
if (isset($_POST['new_task_project']) && $_POST['new_task_project'] && $obj->task_project != $_POST['new_task_project']) {
$obj->task_project = $_POST['new_task_project'];
$obj->task_parent = $obj->task_id;
}
// Map task_dynamic checkboxes to task_dynamic values for task dependencies.
if ($obj->task_dynamic != 1) {
$task_dynamic_delay = dPgetParam($_POST, 'task_dynamic_nodelay', '0');
if (in_array($obj->task_dynamic, $tracking_dynamics)) {
示例4: executePost
/**
* Post Request Handler
*
* This method is called when a request is a POST
*
* @return array
*/
public function executePost()
{
/**
* @todo Remove this once we figure out how to reference vars in file
* that is autoloaded
*/
global $tracking_dynamics;
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
$username = $this->getParam('username');
$password = $this->getParam('password');
$project_id = $this->getParam('project_id', self::TYPE_INT);
$hassign = $this->getParam('hassign');
$hdependencies = $this->getParam('hdependencies');
$notify = $this->getParam('task_notify');
$comment = $this->getParam('email_comment');
$task_id = $this->getParam('task_id');
$adjustStartDate = $this->getParam('set_task_start_date');
$task = new CTask();
// Attempt to login as user, a little bit of a hack as we currently
// require the $_POST['login'] var to be set as well as a global AppUI
$AppUI = new CAppUI();
$GLOBALS['AppUI'] = $AppUI;
$_POST['login'] = 'login';
if (!$AppUI->login($username, $password)) {
throw new Frapi_Error('INVALID_LOGIN');
}
$post_data = array('task_id' => $this->getParam('task_id'), 'task_name' => $this->getParam('task_name'), 'task_status' => $this->getParam('task_status'), 'task_percent_complete' => $this->getParam('task_percent_complete'), 'task_milestone' => $this->getParam('task_milestone'), 'task_owner' => $this->getParam('task_owner'), 'task_access' => $this->getParam('task_access'), 'task_related_url' => $this->getParam('task_related_url'), 'task_parent' => $this->getParam('task_parent'), 'task_type' => $this->getParam('task_type'), 'task_target_budget' => $this->getParam('task_target_budget'), 'task_description' => $this->getParam('task_description'), 'task_start_date' => $this->getParam('task_start_date'), 'task_end_date' => $this->getParam('task_end_date'), 'task_duration' => $this->getParam('task_duration'), 'task_duration_type' => $this->getParam('task_duration_type'), 'task_dynamic' => $this->getParam('task_dynamic'), 'task_allow_other_user_tasklogs' => $this->getParam('task_allow_other_user_tasklogs'), 'task_project' => $this->getParam('task_project'), 'task_priority' => $this->getParam('task_priority'));
// Include any files for handling module-specific requirements
foreach (findTabModules('tasks', 'addedit') as $mod) {
$fname = W2P_BASE_DIR . '/modules/' . $mod . '/tasks_dosql.addedit.php';
if (file_exists($fname)) {
require_once $fname;
}
}
// Find the task if we are set
$task_end_date = null;
if ($task_id) {
$task->load($task_id);
$task_end_date = new w2p_Utilities_Date($task->task_end_date);
}
$task = new CTask();
if (!$task->bind($post_data)) {
throw new Frapi_Error('SAVE_ERROR', $task->getError());
}
if ($task->task_dynamic != 1) {
$task_dynamic_delay = $this->getParam('task_dynamic_nodelay') ? $this->getParam('task_dynamic_nodelay') : '0';
if (in_array($task->task_dynamic, $tracking_dynamics)) {
$task->task_dynamic = $task_dynamic_delay ? 21 : 31;
} else {
$task->task_dynamic = $task_dynamic_delay ? 11 : 0;
}
}
// Let's check if task_dynamic is unchecked
if (!$this->getParam('task_dynamic')) {
$task->task_dynamic = false;
}
// Make sure task milestone is set or reset as appropriate
if ($this->getParam('task_milestone')) {
$task->task_milestone = false;
}
//format hperc_assign user_id=percentage_assignment;user_id=percentage_assignment;user_id=percentage_assignment;
$tmp_ar = explode(';', $this->getParam('hperc_assign'));
$i_cmp = sizeof($tmp_ar);
$hperc_assign_ar = array();
for ($i = 0; $i < $i_cmp; $i++) {
$tmp = explode('=', $tmp_ar[$i]);
if (count($tmp) > 1) {
$hperc_assign_ar[$tmp[0]] = $tmp[1];
} elseif ($tmp[0] != '') {
$hperc_assign_ar[$tmp[0]] = 100;
}
}
// let's check if there are some assigned departments to task
$task->task_departments = implode(',', $this->getParam('dept_ids', self::TYPE_ARRAY));
// convert dates to SQL format first
if ($task->task_start_date) {
$date = new w2p_Utilities_Date($task->task_start_date);
$task->task_start_date = $date->format(FMT_DATETIME_MYSQL);
}
$end_date = null;
if ($task->task_end_date) {
if (strpos($task->task_end_date, '2400') !== false) {
$task->task_end_date = str_replace('2400', '2359', $task->task_end_date);
}
$end_date = new w2p_Utilities_Date($task->task_end_date);
$task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
$error_array = $task->store($AppUI);
// Return all the validation messages
if ($error_array !== true) {
//.........这里部分代码省略.........
示例5: getTaskTooltip
function getTaskTooltip($task_id, $starts = false, $ends = false, $tasks_tips)
{
global $AppUI;
if (!$task_id) {
return '';
}
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$task = new CTask();
$hash = $tasks_tips[$task_id];
// load the record data
$task->bind($hash, null, false, true);
// load the event types
$types = w2PgetSysVal('TaskType');
$assigned = $task->getAssigned();
$start_date = (int) $task->task_start_date ? new CDate($task->task_start_date) : null;
$end_date = (int) $task->task_end_date ? new CDate($task->task_end_date) : null;
// load the record data
$task_project = $task->project_name;
$task_company = $task->company_name;
$tt = '<table border="0" cellpadding="0" cellspacing="0" width="96%">';
$tt .= '<tr>';
$tt .= ' <td valign="top" width="50%">';
$tt .= ' <strong>' . $AppUI->_('Details') . '</strong>';
$tt .= ' <table cellspacing="3" cellpadding="2" width="100%">';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Company') . '</td>';
$tt .= ' <td width="100%">' . $task_company . '</td>';
$tt .= ' </tr>';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Project') . '</td>';
$tt .= ' <td width="100%">' . $task_project . '</td>';
$tt .= ' </tr>';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Type') . '</td>';
$tt .= ' <td width="100%" nowrap="nowrap">' . $AppUI->_($types[$task->task_type]) . '</td>';
$tt .= ' </tr> ';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Progress') . '</td>';
$tt .= ' <td width="100%" nowrap="nowrap"><strong>' . sprintf("%.1f%%", $task->task_percent_complete) . '</strong></td>';
$tt .= ' </tr> ';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Starts') . '</td>';
$tt .= ' <td nowrap="nowrap">' . ($starts ? '<strong>' : '') . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . ($starts ? '</strong>' : '') . '</td>';
$tt .= ' </tr>';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Ends') . '</td>';
$tt .= ' <td nowrap="nowrap">' . ($ends ? '<strong>' : '') . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . ($ends ? '</strong>' : '') . '</td>';
$tt .= ' </tr>';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Assignees') . '</td>';
$tt .= ' <td nowrap="nowrap">';
if (is_array($assigned)) {
$start = false;
foreach ($assigned as $user) {
if ($start) {
$tt .= '<br/>';
} else {
$start = true;
}
$tt .= $user['user_name'] . ' ' . $user['perc_assignment'] . '%';
}
}
$tt .= ' </tr>';
$tt .= ' </table>';
$tt .= ' </td>';
$tt .= ' <td width="50%" valign="top">';
$tt .= ' <strong>' . $AppUI->_('Description') . '</strong>';
$tt .= ' <table cellspacing="0" cellpadding="2" border="0" width="100%">';
$tt .= ' <tr>';
$tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;">';
$tt .= ' ' . $task->task_description;
$tt .= ' </td>';
$tt .= ' </tr>';
$tt .= ' </table>';
$tt .= ' </td>';
$tt .= '</tr>';
$tt .= '</table>';
return $tt;
}