Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function setup()
 {
     parent::setup();
     $this->post = get_entity($this->guid);
     $this->poster = elgg_get_logged_in_user_entity();
     // GUIDs of friends that were tagged in the post
     if (!is_array($this->friend_guids)) {
         $this->friend_guids = string_to_tag_array((string) $this->friend_guids);
     }
     if (!is_array($this->attachment_guids)) {
         $this->attachment_guids = string_to_tag_array((string) $this->attachment_guids);
     }
     if (!is_array($this->upload_guids)) {
         $this->upload_guids = array();
     }
     $this->subtype = Post::SUBTYPE;
     $this->container = $this->poster;
     if ($this->container_guid) {
         $container = get_entity($this->container_guid);
         if ($container) {
             $this->container = $container;
         }
         if ($this->container->guid != $this->poster->guid) {
             $this->subtype = hypeWall()->config->getPostSubtype();
         }
     }
     // For underlying views to know who the container is
     elgg_set_page_owner_guid($this->container->guid);
 }
Esempio n. 2
0
 public function setup()
 {
     parent::setup();
     if (empty($this->subtype)) {
         $this->subtype = hypeDropzone()->config->get('default_upload_subtype');
     }
 }
 /**
  * {@inheritdoc}
  */
 public function setup()
 {
     parent::setup();
     $this->input_categories = get_input('categories');
     $this->hierarchy = json_decode(get_input('hierarchy', json_encode(array())), true);
     $this->root_guid = get_input('container_guid');
     $this->root = get_entity($this->root_guid);
     $this->nodes = array();
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function setup()
 {
     parent::setup();
     $this->entity = get_entity($this->guid);
     $this->sender_guid = $this->sender_guid ?: elgg_get_logged_in_user_guid();
     $this->recipient_guids = Group::create($this->recipient_guids)->guids();
     $this->attachment_guids = Group::create($this->attachments)->guids();
     unset($this->attachments);
     $this->subject = strip_tags((string) $this->subject);
 }
Esempio n. 5
0
 /**
  * Executes an action
  * Triggers 'action:after', $ation hook that allows you to filter the Result object
  *
  * @param Action $controller Action name or instance of Action
  * @param bool  $feedback    Display errors and messages
  * @return ActionResult
  */
 public function execute(Action $controller, $feedback = true)
 {
     try {
         $action = $this->parseActionName();
         elgg_make_sticky_form($action);
         $controller->setup();
         if ($controller->validate() === false) {
             throw new ActionValidationException("Invalid input for action {$action}");
         }
         $controller->execute();
         $this->result = $controller->getResult();
     } catch (ActionValidationException $ex) {
         $this->result->addError($ex->getMessage());
         elgg_log($ex->getMessage(), 'ERROR');
     } catch (PermissionsException $ex) {
         $this->result->addError(elgg_echo('apps:permissions:error'));
         elgg_log($ex->getMessage(), 'ERROR');
     } catch (InvalidEntityException $ex) {
         $this->result->addError(elgg_echo('apps:entity:error'));
         elgg_log($ex->getMessage(), 'ERROR');
     } catch (Exception $ex) {
         $this->result->addError(elgg_echo('apps:action:error'));
         elgg_log($ex->getMessage(), 'ERROR');
     }
     $errors = $this->result->getErrors();
     $messages = $this->result->getMessages();
     if (empty($errors)) {
         elgg_clear_sticky_form($action);
     } else {
         $this->result->setForwardURL(REFERRER);
     }
     if ($feedback) {
         foreach ($errors as $error) {
             register_error($error);
         }
         foreach ($messages as $message) {
             system_message($message);
         }
     }
     return elgg_trigger_plugin_hook('action:after', $action, null, $this->result);
 }
Esempio n. 6
0
 /**
  * {@inheritdoc}
  */
 public function setup()
 {
     parent::setup();
     $this->entity = get_entity($this->guid);
     $this->user = elgg_get_logged_in_user_entity();
 }
Esempio n. 7
0
 /**
  * {@inheridoc}
  */
 public function setup()
 {
     parent::setup();
     $this->entity = get_entity($this->guid);
 }