本文整理汇总了PHP中ajx_replace函数的典型用法代码示例。如果您正苦于以下问题:PHP ajx_replace函数的具体用法?PHP ajx_replace怎么用?PHP ajx_replace使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ajx_replace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
// require_javascript("og/HtmlPanel.js");
require_javascript("og/MessageManager.js");
ajx_current("panel", "messages", null, null, true);
ajx_replace(true);
}
示例2: search
/**
* Execute search
*
* @param void
* @return null
*/
function search()
{
if (active_project() && !logged_user()->isProjectUser(active_project())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
$pageType = array_var($_GET, 'page_type');
$search_for = array_var($_GET, 'search_for');
$objectManagers = array("ProjectWebpages", "ProjectMessages", "MailContents", "ProjectFiles", "ProjectMilestones", "ProjectTasks", "ProjectEvents");
$objectTypes = array(lang('webpages'), lang('messages'), lang('emails'), lang('files'), lang('milestones'), lang('tasks'), lang('events'));
$iconTypes = array('webpage', 'message', 'email', 'file', 'milestone', 'task', 'event');
if (user_config_option('show_file_revisions_search')) {
array_splice($objectManagers, 4, 0, 'ProjectFileRevisions');
array_splice($objectTypes, 4, 0, lang('file contents'));
array_splice($iconTypes, 4, 0, 'file');
}
$search_results = array();
$timeBegin = microtime(true);
if (trim($search_for) == '') {
$search_results = null;
$pagination = null;
} else {
$search_results = $this->searchWorkspaces($search_for, $search_results, 5);
$search_results = $this->searchUsers($search_for, $search_results, 5);
$search_results = $this->searchContacts($search_for, $search_results, 5);
if (array_var($_GET, 'search_all_projects') != "true" && active_project() instanceof Project) {
$projects = active_project()->getAllSubWorkspacesCSV(true);
} else {
$projects = null;
}
$c = 0;
foreach ($objectManagers as $om) {
$user_id = $om == "MailContents" ? logged_user()->getId() : 0;
$results = SearchableObjects::searchByType($search_for, $projects, $om, true, 5, 1, null, $user_id);
if (count($results[0]) > 0) {
$sr = array();
$sr['result'] = $results[0];
$sr['pagination'] = $results[1];
$sr['type'] = $objectTypes[$c];
$sr['icontype'] = $iconTypes[$c];
$sr['manager'] = $om;
$search_results[] = $sr;
}
$c++;
}
}
// if
$timeEnd = microtime(true);
if (str_starts_with($search_for, '"') && str_ends_with($search_for, '"')) {
$search_for = str_replace('"', '', $search_for);
}
tpl_assign('search_string', $search_for);
tpl_assign('search_results', $search_results);
tpl_assign('time', $timeEnd - $timeBegin);
ajx_set_no_toolbar(true);
ajx_replace(true);
}
示例3: init
function init() {
$js_manager_info = array('js_file' => "og/FileManager.js");
Hook::fire('change_js_manager', $this, $js_manager_info);
require_javascript(array_var($js_manager_info, 'js_file'), array_var($js_manager_info, 'plugin'));
ajx_current("panel", "files", null, null, true);
ajx_replace(true);
}
示例4: init
function init()
{
$ot = ObjectTypes::findById(array_var($_REQUEST, 'type_id'));
$dim = Dimensions::findById(array_var($_REQUEST, 'dim_id'));
evt_add("refresh member list parameters", array('object_type_id' => array_var($_REQUEST, 'type_id'), 'dimension_id' => array_var($_REQUEST, 'dim_id'), 'dimension_code' => $dim instanceof Dimension ? $dim->getCode() : '', 'object_type_name' => $ot instanceof ObjectType ? $ot->getName() : ''));
require_javascript("og/MemberManager.js");
ajx_current("panel", "members", null, null, true);
ajx_replace(true);
}
示例5: help_options
function help_options()
{
$show_context_help = user_config_option('show_context_help', 'until_close', logged_user()->getId());
$show = true;
if ($show_context_help == 'never') {
$show = false;
}
tpl_assign('show_help', $show);
ajx_set_panel('help');
ajx_replace(true);
}
示例6: index
/**
* Show events index page (list recent events)
*
* @param void
* @return null
*/
function index($view_type = null, $user_filter = null, $status_filter = null, $task_filter = null)
{
ajx_set_no_toolbar(true);
ajx_replace(true);
$this->getActualDateToShow($day, $month, $year);
if ($view_type == null) {
$this->getUserPreferences($view_type, $user_filter, $status_filter, $task_filter);
}
$this->setTemplate('calendar');
$this->setViewVariables($view_type, $user_filter, $status_filter, $task_filter);
}
示例7: index
/**
* Show events index page (list recent events)
*
* @param void
* @return null
*/
function index($view_type = null, $user_filter = null, $status_filter = null)
{
//auth check in cal_query_get_eventlist
if (!logged_user()->isAdministrator() && (active_project() && !logged_user()->isProjectUser(active_project()))) {
flash_error(lang('no access permissions'));
$this->redirectTo('dashboard');
return;
}
ajx_set_no_toolbar(true);
ajx_replace(true);
$this->getActualDateToShow($day, $month, $year);
if ($view_type == null) {
$this->getUserPreferences($view_type, $user_filter, $status_filter);
}
$tag = active_tag();
tpl_assign('tags', $tag);
$this->setTemplate('calendar');
$this->setViewVariables($view_type, $user_filter, $status_filter);
}
示例8: classify
/**
* Classify specific email
*
*/
function classify()
{
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$email = MailContents::findById(get_id());
if (!$email instanceof MailContent) {
flash_error(lang('email dnx'));
ajx_current("empty");
return;
}
if ($email->getIsDeleted()) {
flash_error(lang('email dnx deleted'));
ajx_current("empty");
return;
}
if (!$email->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
MailUtilities::parseMail($email->getContent(), $decoded, $parsedEmail, $warnings);
$projects = logged_user()->getActiveProjects();
tpl_assign('projects', $projects);
$classification_data = array_var($_POST, 'classification');
if (!is_array($classification_data)) {
$tag_names = $email->getTagNames();
$classification_data = array('tag' => is_array($tag_names) ? implode(', ', $tag_names) : '');
// array
}
// if
if (is_array(array_var($_POST, 'classification'))) {
try {
$create_task = array_var($classification_data, 'create_task') == 'checked';
$canWriteFiles = $this->checkFileWritability($classification_data, $parsedEmail);
if ($canWriteFiles) {
$project_ids = $classification_data["project_ids"];
$enteredWS = Projects::findByCSVIds($project_ids);
$validWS = array();
if (isset($enteredWS)) {
foreach ($enteredWS as $ws) {
if (ProjectFile::canAdd(logged_user(), $ws)) {
$validWS[] = $ws;
}
}
}
if (empty($validWS)) {
flash_error(lang('must choose at least one workspace error'));
ajx_current("empty");
return;
}
DB::beginWork();
$conversation = MailContents::getMailsFromConversation($email);
foreach ($conversation as $conv_email) {
$conv_email->removeFromWorkspaces(logged_user()->getWorkspacesQuery());
foreach ($validWS as $w) {
$conv_email->addToWorkspace($w);
}
$conv_email->save();
MailUtilities::parseMail($conv_email->getContent(), $decoded, $parsedEmail, $warnings);
$csv = array_var($classification_data, 'tag');
$conv_email->setTagsFromCSV($csv);
if ($conv_email->getHasAttachments()) {
//Classify attachments
$this->classifyFile($classification_data, $conv_email, $parsedEmail, $validWS, true, $csv);
}
}
DB::commit();
flash_success(lang('success classify email'));
if ($create_task) {
ajx_replace(true);
$this->redirectTo('task', 'add_task', array('from_email' => $email->getId(), 'replace' => 1));
} else {
ajx_current("back");
evt_add("reload mails panel", array());
}
} else {
flash_error(lang("error classifying attachment cant open file"));
ajx_current("empty");
}
// If can write files
// Error...
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
// try
} else {
$classification_data["project_ids"] = $email->getWorkspaces();
}
tpl_assign('classification_data', $classification_data);
tpl_assign('email', $email);
//.........这里部分代码省略.........
示例9: add_task
/**
* Add new task
*
* @access public
* @param void
* @return null
*/
function add_task()
{
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$project = active_or_personal_project();
if (!ProjectTask::canAdd(logged_user(), $project)) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
$task = new ProjectTask();
$task_data = array_var($_POST, 'task');
if (!is_array($task_data)) {
$task_data = array('milestone_id' => array_var($_POST, 'milestone_id', 0), 'project_id' => array_var($_POST, 'project_id', active_or_personal_project()->getId()), 'title' => array_var($_POST, 'title', ''), 'assigned_to' => array_var($_POST, 'assigned_to', '0:0'), 'parent_id' => array_var($_POST, 'parent_id', 0), 'priority' => array_var($_POST, 'priority', ProjectTasks::PRIORITY_NORMAL), 'text' => array_var($_POST, 'text', ''), 'start_date' => getDateValue(array_var($_POST, 'task_start_date', '')), 'due_date' => getDateValue(array_var($_POST, 'task_due_date', '')), 'is_template' => array_var($_POST, "is_template", array_var($_GET, "is_template", false)), 'tags' => array_var($_POST, "tags", ''), 'object_subtype' => array_var($_POST, "object_subtype", config_option('default task co type')), 'send_notification' => array_var($_POST, 'notify') && array_var($_POST, 'notify') == 'true');
// array
$from_email = array_var($_GET, 'from_email');
$email = MailContents::findById($from_email);
if ($email instanceof MailContent) {
$task_data['title'] = $email->getSubject();
$task_data['text'] = lang('create task from email description', $email->getSubject(), $email->getFrom(), $email->getTextBody());
$task_data['tags'] = implode(", ", $email->getTagNames());
tpl_assign('from_email', $email);
}
}
// if
if (array_var($_GET, 'replace')) {
ajx_replace(true);
}
tpl_assign('task_data', $task_data);
tpl_assign('task', $task);
if (is_array(array_var($_POST, 'task'))) {
$proj = Projects::findById(array_var($task_data, 'project_id'));
if ($proj instanceof Project) {
$project = $proj;
}
// order
$task->setOrder(ProjectTasks::maxOrder(array_var($task_data, "parent_id", 0), array_var($task_data, "milestone_id", 0)));
$task_data['due_date'] = getDateValue(array_var($_POST, 'task_due_date'));
$task_data['start_date'] = getDateValue(array_var($_POST, 'task_start_date'));
try {
$err_msg = $this->setRepeatOptions($task_data);
if ($err_msg) {
flash_error($err_msg);
ajx_current("empty");
return;
}
$task->setFromAttributes($task_data);
$totalMinutes = array_var($task_data, 'time_estimate_hours', 0) * 60 + array_var($task_data, 'time_estimate_minutes', 0);
$task->setTimeEstimate($totalMinutes);
$task->setIsPrivate(false);
// Not used, but defined as not null.
// Set assigned to
$assigned_to = explode(':', array_var($task_data, 'assigned_to', ''));
$company_id = array_var($assigned_to, 0, 0);
$user_id = array_var($assigned_to, 1, 0);
$can_assign = can_assign_task_to_company_user(logged_user(), $task, $company_id, $user_id);
if ($can_assign !== true) {
flash_error($can_assign);
ajx_current("empty");
return;
}
$task->setAssignedToCompanyId($company_id);
$task->setAssignedToUserId($user_id);
$id = array_var($_GET, 'id', 0);
$parent = ProjectTasks::findById($id);
if ($parent instanceof ProjectTask) {
$task->setParentId($id);
if ($parent->getIsTemplate()) {
$task->setIsTemplate(true);
}
}
if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
flash_error(lang('task child of child error'));
ajx_current("empty");
return;
}
//Add handins
$handins = array();
for ($i = 0; $i < 4; $i++) {
if (isset($task_data["handin{$i}"]) && is_array($task_data["handin{$i}"]) && trim(array_var($task_data["handin{$i}"], 'title')) != '') {
$assigned_to = explode(':', array_var($task_data["handin{$i}"], 'assigned_to', ''));
$handins[] = array('title' => array_var($task_data["handin{$i}"], 'title'), 'responsible_company_id' => array_var($assigned_to, 0, 0), 'responsible_user_id' => array_var($assigned_to, 1, 0));
// array
}
// if
}
// for
DB::beginWork();
$task->save();
//.........这里部分代码省略.........
示例10: edit_task
/**
* Edit task
*
* @access public
* @param void
* @return null
*/
function edit_task()
{
$isTemplateTask = false;
if (array_var($_REQUEST, 'template_task') == true) {
$isTemplateTask = true;
}
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$this->setTemplate('add_task');
if (array_var($_REQUEST, "template_task")) {
$task = TemplateTasks::findById(array_var($_REQUEST, "template_task_id", get_id()));
$this->setTemplate(get_template_path('add_template_task', 'template_task'));
if (array_var($_REQUEST, 'template_id')) {
$template_id = array_var($_REQUEST, 'template_id');
} else {
$template_id = $task->getTemplateId();
}
tpl_assign('additional_tt_params', array_var($_REQUEST, 'additional_tt_params'));
tpl_assign('template_id', $template_id);
if (!$task instanceof TemplateTask) {
flash_error(lang('task list dnx'));
ajx_current("empty");
return;
}
// if
} else {
$task = ProjectTasks::findById(get_id());
if (!$task instanceof ProjectTask) {
flash_error(lang('task list dnx'));
ajx_current("empty");
return;
}
// if
if (!$task->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
}
if (array_var($_GET, 'replace')) {
ajx_replace(true);
}
$task_data = array_var($_POST, 'task');
$time_estimate = array_var($_POST, 'hours', 0) * 60 + array_var($_POST, 'minutes', 0);
if ($time_estimate > 0) {
$estimatedTime = $time_estimate;
} else {
$estimatedTime = $task->getTimeEstimate();
}
if (!is_array($task_data)) {
// set layout for modal form
if (array_var($_REQUEST, 'modal')) {
$this->setLayout("json");
tpl_assign('modal', true);
}
$this->getRepeatOptions($task, $occ, $rsel1, $rsel2, $rsel3, $rnum, $rend, $rjump);
$dd = $task->getDueDate() instanceof DateTimeValue ? $task->getDueDate() : null;
if ($dd instanceof DateTimeValue && $task->getUseDueTime()) {
$dd->advance(logged_user()->getTimezone() * 3600);
}
$sd = $task->getStartDate() instanceof DateTimeValue ? $task->getStartDate() : null;
if ($sd instanceof DateTimeValue && $task->getUseStartTime()) {
$sd->advance(logged_user()->getTimezone() * 3600);
}
$post_dd = null;
if (array_var($_POST, 'task_due_date')) {
$post_dd = getDateValue(array_var($_POST, 'task_due_date'));
if ($post_dd instanceof DateTimeValue) {
$duetime = getTimeValue(array_var($_POST, 'task_due_time'));
if (is_array($duetime)) {
$post_dd->setHour(array_var($duetime, 'hours'));
$post_dd->setMinute(array_var($duetime, 'mins'));
$post_dd->advance(logged_user()->getTimezone() * 3600);
}
}
}
$post_st = null;
if (array_var($_POST, 'task_start_date')) {
$post_st = getDateValue(array_var($_POST, 'task_start_date'));
if ($post_st instanceof DateTimeValue) {
$starttime = getTimeValue(array_var($_POST, 'task_start_time'));
if (is_array($starttime)) {
$post_st->setHour(array_var($starttime, 'hours'));
$post_st->setMinute(array_var($starttime, 'mins'));
$post_st->advance(logged_user()->getTimezone() * 3600);
}
}
}
if (config_option("wysiwyg_tasks")) {
//.........这里部分代码省略.........
示例11: classify
/**
* Classify specific email
*
*/
function classify()
{
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$email = MailContents::findById(get_id());
if (!$email instanceof MailContent) {
flash_error(lang('email dnx'));
ajx_current("empty");
return;
}
if ($email->getIsDeleted()) {
flash_error(lang('email dnx deleted'));
ajx_current("empty");
return;
}
if (!$email->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
MailUtilities::parseMail($email->getContent(), $decoded, $parsedEmail, $warnings);
if (array_var($_POST, 'submit')) {
try {
$ctrl = new ObjectController();
$create_task = array_var($classification_data, 'create_task') == 'checked';
$canWriteFiles = $this->checkFileWritability($classification_data, $parsedEmail);
if ($canWriteFiles) {
DB::beginWork();
if ($members = json_decode(array_var($_POST, 'members'))) {
$ctrl->add_to_members($email, $members);
}
$conversation = MailContents::getMailsFromConversation($email);
foreach ($conversation as $conv_email) {
$ctrl->add_to_members($conv_email, $members);
MailUtilities::parseMail($conv_email->getContent(), $decoded, $parsedEmail, $warnings);
if ($conv_email->getHasAttachments()) {
$this->classifyFile($classification_data, $conv_email, $parsedEmail, $members);
}
}
DB::commit();
flash_success(lang('success classify email'));
if ($create_task) {
ajx_replace(true);
$this->redirectTo('task', 'add_task', array('from_email' => $email->getId(), 'replace' => 1));
} else {
ajx_current("back");
evt_add("reload mails panel", array());
}
} else {
flash_error(lang("error classifying attachment cant open file"));
ajx_current("empty");
}
// If can write files
// Error...
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
}
tpl_assign('email', $email);
tpl_assign('parsedEmail', $parsedEmail);
}
示例12: do_classify_mail
/**
* @param $email MailContent to classify
* @param $members array of member ids in which the $email will be classified
* @param $classification_data additional data needed for classification
* @param $process_conversation boolean, if true all the conversation will be classified
* @param $after_receiving boolean, indicates wheather the function was called after receiving the email or if only the user is classiffying the email
*/
function do_classify_mail($email, $members, $classification_data = null, $process_conversation = true, $after_receiving = false)
{
try {
$ctrl = new ObjectController();
$create_task = false;
//array_var($classification_data, 'create_task') == 'checked';
if (is_null($classification_data)) {
$classification_data = array();
MailUtilities::parseMail($email->getContent(), $decoded, $parsedEmail, $warnings);
for ($j = 0; $j < count(array_var($parsedEmail, "Attachments", array())); $j++) {
$classification_data["att_" . $j] = true;
}
}
foreach ($members as $k => &$mem_id) {
if ($mem_id == "") {
unset($members[$k]);
}
}
$canWriteFiles = $this->checkFileWritability($classification_data, $parsedEmail);
if ($canWriteFiles) {
// if $after_receiving == true transaction has already been started, so dont start a new one
if (!$after_receiving) {
DB::beginWork();
}
if (count($members) > 0) {
$account_owner = logged_user() instanceof contact ? logged_user() : Contacts::findById($email->getAccount()->getContactId());
$ctrl->add_to_members($email, $members, $account_owner);
if ($after_receiving && $email->getHasAttachments() && user_config_option('auto_classify_attachments') || !$after_receiving && $email->getHasAttachments() && (user_config_option('mail_drag_drop_prompt') == 'classify' || user_config_option('mail_drag_drop_prompt') == 'prompt' && intval(array_var($_REQUEST, 'classify_attachments')) > 0)) {
if (count($members) > 0) {
$member_instances = Members::findAll(array('conditions' => 'id IN (' . implode(',', $members) . ')'));
MailUtilities::parseMail($email->getContent(), $decoded, $parsedEmail, $warnings);
$this->classifyFile($classification_data, $email, $parsedEmail, $member_instances, false, !$after_receiving);
}
}
} else {
$email->removeFromMembers(logged_user() instanceof contact ? logged_user() : Contacts::findById($email->getAccount()->getContactId(), $email->getMembers()));
}
if ($process_conversation) {
$conversation = MailContents::getMailsFromConversation($email);
if (count($members) > 0) {
$member_instances = Members::findAll(array('conditions' => 'id IN (' . implode(',', $members) . ')'));
foreach ($conversation as $conv_email) {
// dont process orignal email again
if ($conv_email->getId() == $email->getId()) {
continue;
}
$account_owner = logged_user() instanceof contact ? logged_user() : Contacts::findById($conv_email->getAccount()->getContactId());
$ctrl->add_to_members($conv_email, $members, $account_owner);
MailUtilities::parseMail($conv_email->getContent(), $decoded, $parsedEmail, $warnings);
if ($conv_email->getHasAttachments()) {
if ($after_receiving && user_config_option('auto_classify_attachments') || !$after_receiving && (user_config_option('mail_drag_drop_prompt') == 'classify' || user_config_option('mail_drag_drop_prompt') == 'prompt' && intval(array_var($_REQUEST, 'classify_attachments')) > 0)) {
$this->classifyFile($classification_data, $conv_email, $parsedEmail, $member_instances, false, !$after_receiving);
}
}
}
} else {
if (!$after_receiving) {
foreach ($conversation as $conv_email) {
$conv_email->removeFromMembers(logged_user() instanceof contact ? logged_user() : Contacts::findById($email->getAccount()->getContactId(), $conv_email->getMembers()));
}
}
}
}
if (!$after_receiving) {
DB::commit();
}
flash_success(lang('success classify email'));
if ($create_task) {
ajx_replace(true);
$this->redirectTo('task', 'add_task', array('from_email' => $email->getId(), 'replace' => 1));
} else {
ajx_current("back");
if (!$after_receiving) {
evt_add("reload current panel", array());
}
}
} else {
flash_error(lang("error classifying attachment cant open file"));
ajx_current("empty");
}
// If can write files
// Error...
} catch (Exception $e) {
if (!$after_receiving) {
DB::rollback();
}
flash_error($e->getMessage());
ajx_current("empty");
}
}
示例13: do_classify_mail
function do_classify_mail($email, $members, $classification_data = null) {
try {
$ctrl = new ObjectController();
$create_task = false;//array_var($classification_data, 'create_task') == 'checked';
if (is_null($classification_data)) {
$classification_data = array();
MailUtilities::parseMail($email->getContent(), $decoded, $parsedEmail, $warnings);
for ($j=0; $j < count(array_var($parsedEmail, "Attachments", array())); $j++) {
$classification_data["att_".$j] = true;
}
}
$canWriteFiles = $this->checkFileWritability($classification_data, $parsedEmail);
if ($canWriteFiles) {
DB::beginWork();
if ($members) {
$account_owner = logged_user() instanceof contact ? logged_user() : Contacts::findById($email->getAccount()->getContactId());
$ctrl->add_to_members($email, $members, $account_owner);
}
$conversation = MailContents::getMailsFromConversation($email);
if (count($members) > 0) {
$member_instances = Members::findAll(array('conditions' => 'id IN ('.implode(',',$members).')'));
foreach ($conversation as $conv_email) {
$account_owner = logged_user() instanceof contact ? logged_user() : Contacts::findById($conv_email->getAccount()->getContactId());
$ctrl->add_to_members($conv_email, $members, $account_owner);
MailUtilities::parseMail($conv_email->getContent(), $decoded, $parsedEmail, $warnings);
if ($conv_email->getHasAttachments()) {
$this->classifyFile($classification_data, $conv_email, $parsedEmail, $member_instances, true);
}
}
}
DB::commit();
flash_success(lang('success classify email'));
if ($create_task) {
ajx_replace(true);
$this->redirectTo('task', 'add_task', array('from_email' => $email->getId(), 'replace' => 1));
} else {
ajx_current("back");
evt_add("reload mails panel", array());
}
} else {
flash_error(lang("error classifying attachment cant open file"));
ajx_current("empty");
} // If can write files
// Error...
} catch(Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
}
示例14: show_all_linked_objects
function show_all_linked_objects()
{
require_javascript("og/LinkedObjectsManager.js");
ajx_current("panel", "linkedobject", null, array('linked_object' => array_var($_GET, 'linked_object'), 'linked_object_name' => array_var($_GET, 'linked_object_name'), 'linked_object_ico' => array_var($_GET, 'linked_object_ico')));
ajx_replace(true);
}
示例15: edit_task
/**
* Edit task
*
* @access public
* @param void
* @return null
*/
function edit_task()
{
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$this->setTemplate('add_task');
$task = ProjectTasks::findById(get_id());
if (!$task instanceof ProjectTask) {
flash_error(lang('task list dnx'));
ajx_current("empty");
return;
}
// if
if (!$task->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
if (array_var($_GET, 'replace')) {
ajx_replace(true);
}
$task_data = array_var($_POST, 'task');
$time_estimate = array_var($_POST, 'hours', 0) * 60 + array_var($_POST, 'minutes', 0);
if ($time_estimate > 0) {
$estimatedTime = $time_estimate;
} else {
$estimatedTime = $task->getTimeEstimate();
}
if (!is_array($task_data)) {
$this->getRepeatOptions($task, $occ, $rsel1, $rsel2, $rsel3, $rnum, $rend, $rjump);
$dd = $task->getDueDate() instanceof DateTimeValue ? $task->getDueDate()->advance(logged_user()->getTimezone() * 3600, false) : null;
$sd = $task->getStartDate() instanceof DateTimeValue ? $task->getStartDate()->advance(logged_user()->getTimezone() * 3600, false) : null;
$post_dd = null;
if (array_var($_POST, 'task_due_date')) {
$post_dd = getDateValue(array_var($_POST, 'task_due_date'));
if ($post_dd instanceof DateTimeValue) {
$duetime = getTimeValue(array_var($_POST, 'task_due_time'));
if (is_array($duetime)) {
$post_dd->setHour(array_var($duetime, 'hours'));
$post_dd->setMinute(array_var($duetime, 'mins'));
$post_dd->advance(logged_user()->getTimezone() * 3600, false);
}
}
}
$post_st = null;
if (array_var($_POST, 'task_start_date')) {
$post_st = getDateValue(array_var($_POST, 'task_start_date'));
if ($post_st instanceof DateTimeValue) {
$starttime = getTimeValue(array_var($_POST, 'task_start_time'));
if (is_array($starttime)) {
$post_st->setHour(array_var($starttime, 'hours'));
$post_st->setMinute(array_var($starttime, 'mins'));
$post_st->advance(logged_user()->getTimezone() * 3600, false);
}
}
}
$task_data = array('name' => array_var($_POST, 'name', $task->getObjectName()), 'text' => array_var($_POST, 'text', $task->getText()), 'milestone_id' => array_var($_POST, 'milestone_id', $task->getMilestoneId()), 'due_date' => getDateValue($post_dd, $dd), 'start_date' => getDateValue($post_st, $sd), 'parent_id' => $task->getParentId(), 'assigned_to_contact_id' => array_var($_POST, 'assigned_to_contact_id', $task->getAssignedToContactId()), 'priority' => array_var($_POST, 'priority', $task->getPriority()), 'send_notification' => array_var($_POST, 'notify') == 'true', 'time_estimate' => $estimatedTime, 'percent_completed' => $task->getPercentCompleted(), 'forever' => $task->getRepeatForever(), 'rend' => $rend, 'rnum' => $rnum, 'rjump' => $rjump, 'rsel1' => $rsel1, 'rsel2' => $rsel2, 'rsel3' => $rsel3, 'occ' => $occ, 'repeat_by' => $task->getRepeatBy(), 'object_subtype' => array_var($_POST, "object_subtype", $task->getObjectSubtype() != 0 ? $task->getObjectSubtype() : config_option('default task co type')), 'type_content' => $task->getTypeContent(), 'multi_assignment' => $task->getColumnValue('multi_assignment', 0));
// array
}
// if
//I find all those related to the task to find out if the original
$task_related = ProjectTasks::findByRelated($task->getObjectId());
if (!$task_related) {
//is not the original as the original look plus other related
if ($task->getOriginalTaskId() != "0") {
$task_related = ProjectTasks::findByTaskAndRelated($task->getObjectId(), $task->getOriginalTaskId());
}
}
if ($task_related) {
$pending_id = 0;
foreach ($task_related as $t_rel) {
if ($task->getStartDate() <= $t_rel->getStartDate() && $task->getDueDate() <= $t_rel->getDueDate() && !$t_rel->isCompleted()) {
$pending_id = $t_rel->getId();
break;
}
}
tpl_assign('pending_task_id', $pending_id);
tpl_assign('task_related', true);
} else {
tpl_assign('pending_task_id', 0);
tpl_assign('task_related', false);
}
tpl_assign('task', $task);
tpl_assign('task_data', $task_data);
if (is_array(array_var($_POST, 'task'))) {
$send_edit = false;
if ($task->getAssignedToContactId() == array_var($task_data, 'assigned_to_contact_id')) {
$send_edit = true;
}
$old_owner = $task->getAssignedTo();
//.........这里部分代码省略.........