/** * Reopen specific object * * @param void * @return null */ function open() { if (!$this->active_object->canEdit($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall()); } // if if ($this->request->get('ajax_complete_reopen')) { if ($this->request->isSubmitted()) { db_begin_work(); $action = $this->active_object->open($this->logged_user); if ($action && !is_error($action)) { db_commit(); } else { db_rollback(); } // if } // if require_once SYSTEM_MODULE_PATH . '/helpers/function.object_complete.php'; print smarty_function_object_complete(array('object' => $this->active_object, 'user' => $this->logged_user), $this->smarty); die; } else { $this->executeOnActiveObject('open', array($this->logged_user), lang(':type ":name" has been reopened', array('type' => $this->active_object->getVerboseType(), 'name' => $this->active_object->getName())), lang('Failed to open :type ":name"', array('type' => $this->active_object->getVerboseType(true), 'name' => $this->active_object->getName()))); } // if }
/** * Toggles object completed state * */ function toggle_completed() { $object_id = (int) $this->request->get('object_id'); if ($object_id) { $object = ProjectObjects::findById($object_id); } else { $object = new ProjectObject(); } // if if ($object->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if ($object->isCompleted()) { $object->open($this->logged_user); } else { $object->complete($this->logged_user); } $this->redirectToUrl(mobile_access_module_get_view_url($object)); }