function convert_object_to_page()
 {
     $process_mode = $_GET['process'];
     $message = '';
     if (empty($process_mode)) {
         switch ($this->active_object->getType()) {
             case 'Milestone':
                 $message = 'This action will convert the Project: "' . $this->active_object->getName() . '" to Page.';
                 break;
             case 'Ticket':
                 $message = 'This action will convert the Ticket: "' . $this->active_object->getName() . '" to Page.';
                 break;
         }
     } else {
         $error = '';
         $page_id = $this->active_object->convertToPage($this->logged_user, $error);
         if (!empty($page_id)) {
             $this->redirectToUrl(assemble_url('project_page', array('project_id' => $this->active_project->getId(), 'page_id' => $page_id)));
         }
     }
     $this->smarty->assign(array('message' => $message, 'redirect_url' => assemble_url('project_object_convert_to_page', array('project_id' => $this->active_object->getProjectId(), 'object_id' => $this->active_object->getId(), 'process' => '1'))));
 }
 /**
  * Show and process reorder task form
  *
  * @param void
  * @return null
  */
 function reorder()
 {
     $this->wireframe->print_button = false;
     if (!instance_of($this->active_task_parent, 'ProjectObject')) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_task_parent->canSubtask($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $order_data = $this->request->post('task');
     $ids = array_keys($order_data);
     if (is_foreachable($order_data)) {
         $x = 1;
         foreach ($order_data as $key => $value) {
             $order_data[$key] = $x;
             $x++;
         }
         // foreach
     }
     // if
     $tasks = Tasks::findByIds($ids, STATE_VISIBLE, $this->logged_user->getVisibility());
     if (is_foreachable($tasks)) {
         foreach ($tasks as $task) {
             $task->setParent($this->active_task_parent);
             $task->setProjectId($this->active_task_parent->getProjectId());
             $task->setVisibility($this->active_task_parent->getVisibility());
             $task->setPosition(array_var($order_data, $task->getId()));
             $task->save();
         }
         // foreach
     }
     // if
     $this->httpOk();
 }
Пример #3
0
 /**
  * Return unsubscribe from object URL
  *
  * @param ProjectObject $object
  * @return string
  */
 function getUnsubscribeUrl($object)
 {
     return assemble_url('project_object_unsubscribe_user', array('project_id' => $object->getProjectId(), 'object_id' => $object->getId(), 'user_id' => $this->getId()));
 }
 /**
  * Add new entry to the log
  *
  * @param ProjectObject $object
  * @param User $by
  * @param string $comment
  * @return null
  */
 function log($object, $by = null, $comment = null)
 {
     $this->setType(get_class($this));
     $this->setObjectId($object->getId());
     $this->setProjectId($object->getProjectId());
     if ($by === null) {
         $by = get_logged_user();
     }
     // if
     $this->setCreatedBy($by);
     $this->setCreatedOn(new DateTimeValue());
     if ($comment) {
         $this->setComment($comment);
     }
     // if
     return $this->save();
 }
 /**
  * Write Activity Log
  *
  * @param ProjectObject $object
  * @param User $user
  * @param string $action
  * @param string $comment
  * @return null
  */
 function write($object, $user, $action, $comment = null)
 {
     if (!instance_of($user, 'User') && !instance_of($user, 'AnonymousUser')) {
         $user =& get_logged_user();
         if (!instance_of($user, 'User')) {
             return false;
         }
         // if
     }
     // if
     $activity_log = new ActivityLog();
     $activity_log->setAttributes(array('object_id' => $object->getId(), 'project_id' => $object->getProjectId(), 'action' => $action, 'comment' => $comment));
     $activity_log->setCreatedBy($user);
     return $activity_log->save();
 }