Example #1
0
 /**
  * Responsible to output the html codes that is displayed to a user.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   SocialCluster   $cluster    The cluster object.
  */
 public function onDisplay($cluster)
 {
     $value = $cluster->getName();
     // Push variables into theme.
     $this->set('value', $this->escape($value));
     return $this->display();
 }
Example #2
0
 /**
  * Displays the field for edit.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  * @param   array           $errors     The errors array.
  * @return  string                      The html codes for this field.
  */
 public function onEdit(&$post, &$cluster, $errors)
 {
     $value = isset($post['allowmaybe']) ? (bool) $post['allowmaybe'] : $cluster->getParams()->get('allowmaybe', true);
     $error = $this->getError($errors);
     $this->set('error', $error);
     $this->set('value', $value);
     return $this->display();
 }
Example #3
0
 /**
  * Displays the field for edit.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  * @param   array           $errors     The errors array.
  * @return  string                      The html codes for this field.
  */
 public function onEdit(&$post, &$cluster, $errors)
 {
     $value = isset($post['guestlimit']) ? (int) $post['guestlimit'] : (int) $cluster->getParams()->get('guestlimit', 0);
     $error = $this->getError($errors);
     $this->set('error', $error);
     $this->set('value', $value);
     return $this->display();
 }
Example #4
0
 /**
  * Executes before the event is saved.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  */
 public function onEditBeforeSave(&$post, &$cluster)
 {
     // Support for recurring event
     // If this is a recurring event, then we do not want to process this
     if ($cluster->isRecurringEvent() && !empty($post['applyRecurring'])) {
         unset($post[$this->inputName]);
         return true;
     }
     $value = !empty($post[$this->inputName]) ? $post[$this->inputName] : $cluster->title;
     $model = FD::model('Events');
     $alias = $model->getUniqueAlias($value, $cluster->id);
     $cluster->alias = $alias;
     unset($post[$this->inputName]);
     return true;
 }
Example #5
0
 /**
  * Executes before the event is saved.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  */
 public function onEditBeforeSave(&$post, &$cluster)
 {
     // We need to know if the news app is published
     if (!$this->appEnabled()) {
         return;
     }
     // Get the posted value
     $value = isset($post[$this->inputName]) ? $post[$this->inputName] : $params->get('news', $this->params->get('default'));
     $value = (bool) $value;
     $registry = $cluster->getParams();
     $registry->set('news', $value);
     $cluster->params = $registry->toString();
     unset($post[$this->inputName]);
 }
Example #6
0
 /**
  * Executes before the event is created.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  */
 public function onEditBeforeSave(&$post, &$cluster)
 {
     if ($cluster->isGroupEvent()) {
         // Currently, the type always follow group type
         // There is a separate checking where user must be group member to join the event
         $cluster->type = FD::group($cluster->getMeta('group_id'))->type;
         unset($post['event_type']);
         return;
     }
     $type = isset($post['event_type']) ? $post['event_type'] : $cluster->type;
     $cluster->type = $type;
     unset($post['event_type']);
 }
Example #7
0
 /**
  * Logics for deleting an event
  *
  * @since   1.3
  * @access  public
  * @return  boolean True if successful.
  */
 public function delete()
 {
     // @trigger onBeforeDelete
     $dispatcher = FD::dispatcher();
     // @points: groups.remove
     // Deduct points when a group is deleted
     FD::points()->assign('events.remove', 'com_easysocial', $this->getCreator()->id);
     // Set the arguments
     $args = array(&$this);
     // @trigger onBeforeStorySave
     $dispatcher->trigger(SOCIAL_TYPE_EVENT, 'onBeforeDelete', $args);
     // Delete any relations from the calendar table
     $this->deleteFromCalendar();
     // Delete all members from the cluster nodes.
     $this->deleteNodes();
     // Delete custom fields data for this cluster.
     $this->deleteCustomFields();
     // Delete photos albums for this cluster.
     $this->deletePhotoAlbums();
     // Delete stream items for this group
     $this->deleteStream();
     // Delete all group news
     $this->deleteNews();
     // delete all user notification associated with this group.
     $this->deleteNotifications();
     // Delete from the cluster
     $state = parent::delete();
     $args[] = $state;
     // @trigger onAfterDelete
     $dispatcher->trigger(SOCIAL_TYPE_EVENT, 'onAfterDelete', $args);
     return $state;
 }
Example #8
0
 /**
  * Executes before the event is saved.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  */
 public function onEditBeforeSave(&$post, &$cluster)
 {
     // Get the posted value
     $value = isset($post['event_allday']) ? $post['event_allday'] : $cluster->isAllDay();
     $value = (bool) $value;
     $cluster->meta->all_day = $value;
     unset($post['event_allday']);
 }
Example #9
0
 /**
  * Executes before the event is saved.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  */
 public function onEditBeforeSave(&$post, &$cluster)
 {
     // Get the posted value
     $value = isset($post['photo_albums']) ? $post['photo_albums'] : $cluster->getParams()->get('photo.albums', $this->params->get('default'));
     $value = (bool) $value;
     $registry = $cluster->getParams();
     $registry->set('photo.albums', $value);
     $cluster->params = $registry->toString();
     unset($post['photo_albums']);
 }
Example #10
0
 /**
  * Executes before the event is saved.
  *
  * @author  Jason Rey <*****@*****.**>
  * @since   1.3
  * @access  public
  * @param   array           $post       The posted data.
  * @param   SocialCluster   $cluster    The cluster object.
  */
 public function onEditBeforeSave(&$post, &$cluster)
 {
     // Get the posted value
     $value = isset($post[$this->inputName]) ? $post[$this->inputName] : $params->get('discussions', $this->params->get('default'));
     $value = (bool) $value;
     $registry = $cluster->getParams();
     $registry->set('discussions', $value);
     $cluster->params = $registry->toString();
     unset($post[$this->inputName]);
 }