<?php if ($task_list->getDueDate()->getYear() > DateTimeValueLib::now()->getYear()) { ?> <div class="dueDate"><span class="bold"><?php echo lang('due date') ?>: </span><?php echo format_datetime($task_list->getDueDate(), null, 0) ?></div> <?php } else { ?> <div class="dueDate"><span class="bold"><?php echo lang('due date') ?>: </span> <?php echo format_descriptive_date($task_list->getDueDate()); if ($task_list->getUseDueTime()) { echo ", " . format_time($task_list->getDueDate(), user_config_option('time_format_use_24') ? 'G:i' : 'g:i A'); } ?> </div> <?php } ?> <?php } ?> <?php if ($task_list->getObjectSubtype() > 0) { $subType = ProjectCoTypes::findById($task_list->getObjectSubtype()); if ($subType instanceOf ProjectCoType ) { echo "<div><span class='bold'>" . lang('object type') . ":</span> " . $subType->getName() . "</div>"; } } ?> <?php if($task_list->getText()) { ?> <fieldset><legend><?php echo lang('description') ?></legend> <div class="wysiwyg-description"><?php if($task_list->getTypeContent() == "text"){ echo escape_html_whitespace(convert_to_links(clean($task_list->getText()))); }else{ echo purify_html(nl2br($task_list->getText())); } ?></div>
function object_subtypes() { if (!logged_user()->isAdminGroup()) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } // if $co_types = array(); $managers = array("tasks" => "ProjectTasks"); foreach ($managers as $title => $manager) { $co_types[$manager] = ProjectCoTypes::getObjectTypesByManager($manager); } tpl_assign('managers', $managers); tpl_assign('co_types', $co_types); $object_subtypes = array_var($_POST, 'subtypes'); if (is_array($object_subtypes)) { try { DB::beginWork(); foreach ($object_subtypes as $manager => $subtypes) { foreach ($subtypes as $subtype) { $type = ProjectCoTypes::findById(array_var($subtype, 'id', 0)); if (!$type instanceof ProjectCoType) { $type = new ProjectCoType(); $type->setObjectManager($manager); } if (!array_var($subtype, 'deleted')) { $type->setName(array_var($subtype, 'name', '')); $type->save(); } else { eval('$man_instance = ' . $manager . "::instance();"); if ($man_instance instanceof ProjectDataObjects && array_var($subtype, 'id', 0) > 0) { $objects = $man_instance->findAll(array('conditions' => "`object_subtype`=" . array_var($subtype, 'id', 0))); if (is_array($objects)) { foreach ($objects as $obj) { if ($obj instanceof DataObject) { $obj->setColumnValue('object_subtype', 0); $obj->save(); } } } } if ($type instanceof ProjectCoType) { $type->delete(); } } } } DB::commit(); flash_success(lang("success save object subtypes")); ajx_current("back"); } catch (Exception $e) { DB::rollback(); flash_error($e->getMessage()); ajx_current("empty"); } } }
static function getExternalColumnValue($field, $id) { $value = ''; if ($field == 'company_id' || $field == 'assigned_to_company_id') { $company = Companies::findById($id); if ($company instanceof Company) { $value = $company->getName(); } } else { if ($field == 'user_id' || $field == 'created_by_id' || $field == 'updated_by_id' || $field == 'assigned_to_user_id' || $field == 'completed_by_id') { $user = Users::findById($id); if ($user instanceof User) { $value = $user->getUsername(); } } else { if ($field == 'milestone_id') { $milestone = ProjectMilestones::findById($id); if ($milestone instanceof ProjectMilestone) { $value = $milestone->getName(); } } else { if ($field == 'object_subtype') { $object_subtype = ProjectCoTypes::findById($id); if ($object_subtype instanceof ProjectCoType) { $value = $object_subtype->getName(); } } } } } return $value; }