コード例 #1
0
ファイル: form.php プロジェクト: knigherrant/decopatio
 /**
  * Generates token for the form.
  *
  * @since	1.0
  * @access	public
  * @return	string
  */
 public static function token()
 {
     $theme = FD::themes();
     $token = FD::token();
     $theme->set('token', $token);
     $content = $theme->output('admin/html/form.token');
     return $content;
 }
コード例 #2
0
ファイル: configuration.php プロジェクト: ppantilla/bbninja
 public function __construct()
 {
     $config = FD::config();
     $this->namespace = "EASYSOCIAL";
     $this->shortName = "es";
     $this->environment = $config->get('general.environment');
     $this->mode = $config->get('general.mode');
     $this->inline = $config->get('general.inline');
     $this->version = FD::getLocalVersion();
     $this->baseUrl = FD::getBaseUrl();
     $this->token = FD::token();
     $this->enableCdn = $config->get('general.cdn.enabled');
     // moment locale mapping against joomla language
     // If the counter part doesn't exist, then we all back to the nearest possible one, or en-gb
     $momentLangMap = array('af-za' => 'en-gb', 'ar-aa' => 'ar', 'bg-bg' => 'bg', 'bn-bd' => 'en-gb', 'ca-es' => 'ca', 'cs-cz' => 'cs', 'da-dk' => 'da', 'de-de' => 'de', 'el-gr' => 'el', 'en-gb' => 'en-gb', 'en-us' => 'en-gb', 'es-cl' => 'es', 'es-es' => 'es', 'fa-ir' => 'fa', 'fi-fi' => 'fi', 'fr-fr' => 'fr', 'he-il' => 'he', 'hr-hr' => 'hr', 'hu-hu' => 'hu', 'hy-am' => 'hy-am', 'id-id' => 'id', 'it-it' => 'it', 'ja-jp' => 'ja', 'ko-kr' => 'ko', 'lt-lt' => 'lt', 'ms-my' => 'ms-my', 'nb-no' => 'nb', 'nl-nl' => 'nl', 'pl-pl' => 'pl', 'pt-br' => 'pt-br', 'pt-pt' => 'pt', 'ro-ro' => 'ro', 'ru-ru' => 'ru', 'sq-al' => 'sq', 'sv-se' => 'sv', 'sw-ke' => 'en-gb', 'th-th' => 'th', 'tr-tr' => 'tr', 'uk-ua' => 'uk', 'vi-vn' => 'vi', 'zh-cn' => 'zh-cn', 'zh-hk' => 'zh-cn', 'zh-tw' => 'zh-tw');
     $this->options['momentLang'] = $momentLangMap[strtolower(JFactory::getLanguage()->getTag())];
     // Let the component configuration initialize all values
     parent::__construct();
 }
コード例 #3
0
ファイル: groups.php プロジェクト: BetterBetterBetter/B3App
 /**
  * Saves a group
  *
  * @since   1.2
  * @access  public
  * @param   string
  * @return
  */
 public function store()
 {
     // Check for request forgeries
     FD::checkToken();
     // Load front end's language file
     FD::language()->loadSite();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the current task
     $task = $this->getTask();
     // Determines if this group is being edited.
     $id = $this->input->get('id', 0, 'int');
     // Flag to see if this is new or edit
     $isNew = empty($id);
     // Get the posted data
     $post = $this->input->getArray('post');
     $options = array();
     if ($isNew) {
         // Include group library
         FD::import('admin:/includes/group/group');
         $group = new SocialGroup();
         $categoryId = $this->input->get('category_id', 0, 'int');
     } else {
         $group = FD::group($id);
         $options['data'] = true;
         $options['dataId'] = $group->id;
         $options['dataType'] = SOCIAL_FIELDS_GROUP_GROUP;
         $categoryId = $group->category_id;
     }
     // Set the necessary data
     $options['uid'] = $categoryId;
     $options['group'] = SOCIAL_FIELDS_GROUP_GROUP;
     // Get fields model
     $fieldsModel = FD::model('Fields');
     // Get the custom fields
     $fields = $fieldsModel->getCustomFields($options);
     // Initialize default registry
     $registry = FD::registry();
     // Get disallowed keys so we wont get wrong values.
     $disallowed = array(FD::token(), 'option', 'task', 'controller', 'autoapproval');
     // Process $_POST vars
     foreach ($post as $key => $value) {
         if (!in_array($key, $disallowed)) {
             if (is_array($value)) {
                 $value = json_encode($value);
             }
             $registry->set($key, $value);
         }
     }
     // Convert the values into an array.
     $data = $registry->toArray();
     // Get the fields lib
     $fieldsLib = FD::fields();
     // Build arguments to be passed to the field apps.
     $args = array(&$data, &$group);
     // @trigger onAdminEditValidate
     $errors = $fieldsLib->trigger('onAdminEditValidate', $options['group'], $fields, $args);
     // If there are errors, we should be exiting here.
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_FORM_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('form', $errors);
     }
     // @trigger onAdminEditBeforeSave
     $errors = $fieldsLib->trigger('onAdminEditBeforeSave', $options['group'], $fields, $args);
     // If there are errors, we should be exiting here.
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_FORM_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('form', $errors);
     }
     // Initialise group data for new group
     if ($isNew) {
         // Set the category id for the group
         $group->category_id = $categoryId;
         $group->creator_uid = $this->my->id;
         $group->creator_type = SOCIAL_TYPE_USER;
         $group->state = SOCIAL_STATE_PUBLISHED;
         $group->hits = 0;
         // Generate a unique key for this group which serves as a password
         $group->key = md5(FD::date()->toSql() . $this->my->password . uniqid());
     }
     // Bind the user object with the form data.
     $group->bind($data);
     // Save the group
     $group->save();
     // After the group is created, assign the current user as the node item
     if ($isNew) {
         $group->createOwner($this->my->id);
     }
     // Reconstruct args
     $args = array(&$data, &$group);
     // @trigger onEditAfterSave
     $fieldsLib->trigger('onAdminEditAfterSave', $options['group'], $fields, $args);
     // Bind the custom fields for the group.
     $group->bindCustomFields($data);
     // Reconstruct args
     $args = array(&$data, &$group);
     // @trigger onEditAfterSaveFields
     $fieldsLib->trigger('onAdminEditAfterSaveFields', $options['group'], $fields, $args);
     $message = $id ? JText::_('COM_EASYSOCIAL_GROUPS_FORM_SAVE_UPDATE_SUCCESS') : JText::_('COM_EASYSOCIAL_GROUPS_FORM_CREATE_SUCCESS');
     $view->setMessage($message, SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $task, $group);
 }
コード例 #4
0
ファイル: registration.php プロジェクト: ppantilla/bbninja
 /**
  * Processes quick registrations
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function miniRegister()
 {
     FD::checkToken();
     // Get current user's info
     $session = JFactory::getSession();
     // Get necessary info about the current registration process.
     $registration = FD::table('Registration');
     $registration->load($session->getId());
     // Get a new registry object
     $registry = FD::get('Registry');
     if (!empty($registration->values)) {
         $registry->load($registration->values);
     }
     // Load json library
     $json = FD::json();
     // Get the token string
     $token = FD::token();
     // Get post values
     $post = JRequest::get('POST');
     // Keys to exclude
     $exclude = array($token, 'option', 'controller', 'task');
     // Process $_POST vars
     foreach ($post as $key => $value) {
         if (!in_array($key, $exclude)) {
             if (is_array($value)) {
                 $value = $json->encode($value);
             }
             $registry->set($key, $value);
         }
     }
     $profileModel = FD::model('profiles');
     $totalProfiles = $profileModel->getTotalProfiles();
     $config = FD::config();
     $minimode = $config->get('registrations.mini.mode', 'quick');
     $miniprofile = $config->get('registrations.mini.profile', 'default');
     // Might be coming from module, in which we have to respect module settings
     if (isset($post['modRegisterType']) && isset($post['modRegisterProfile'])) {
         $minimode = $post['modRegisterType'];
         $miniprofile = $post['modRegisterProfile'];
     }
     $profileId = 0;
     // If selected profile is default, then we check how many profiles are there
     if ($miniprofile === 'default') {
         // If only 1 profile is found, then we assign it directly
         // if ($totalProfiles == 1) {
         // 	$profileId = $profileModel->getDefaultProfile()->id;
         // }
         // We no longer allow the ability for user to select profile
         // This is because the rendered field might be different from user selected profile
         // Under that case, the mapping of the fields will be off and unable to validate/store accordingly
         // EG. Profile 1 has a password field with id 3, while Profile 2 has a password field id 5, if the rendered field is 3, but user selected profile 2, validation will fail because of field mismatch
         // Hence if the settings is set to default profile, then we always use default profile
         $profileId = $profileModel->getDefaultProfile()->id;
     } else {
         $profileId = $miniprofile;
     }
     if (!empty($profileId)) {
         // Set the profile id directly
         $registration->profile_id = $profileId;
         $registry->set('profile_id', $profileId);
         // Directly set the registration step as 1
         $registration->step = 1;
         $registration->addStepAccess(1);
     }
     $registration->values = $registry->toString();
     $state = $registration->store();
     $view = $this->getCurrentView();
     // Decide what to do here based on the configuration
     // FULL -> Registration page, registration page then decides if there is 1 or more profile to choose
     // QUICK && profile id assigned -> quickRegistration
     // QUICK && no profile id -> Registration page with parameter quick=1
     // If mode is set to full, then we redirect to registration page
     if ($minimode === 'full') {
         $view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATIONS_COMPLETE_REGISTRATION'), SOCIAL_MSG_INFO);
         return $view->call('fullRegister', $profileId);
     }
     if ($minimode === 'quick') {
         if (empty($profileId)) {
             return $view->call('selectProfile');
         } else {
             return $this->quickRegister();
         }
     }
     return $view->call(__FUNCTION__);
 }
コード例 #5
0
ファイル: events.php プロジェクト: knigherrant/decopatio
 public function store()
 {
     FD::checkToken();
     FD::language()->loadSite();
     $my = FD::user();
     $view = $this->getCurrentView();
     $task = $this->getTask();
     $id = JRequest::getInt('id');
     $event = FD::event($id);
     $isNew = empty($event->id);
     $post = JRequest::get('POST');
     $options = array();
     if ($isNew) {
         $event->category_id = JRequest::getInt('category_id');
         $event->creator_uid = $my->id;
         $event->creator_type = SOCIAL_TYPE_USER;
         $event->state = SOCIAL_STATE_PUBLISHED;
         $event->key = md5(FD::date()->toSql() . $my->password . uniqid());
     } else {
         $options['data'] = true;
         $options['dataId'] = $event->id;
         $options['dataType'] = SOCIAL_FIELDS_GROUP_EVENT;
     }
     $options['uid'] = $event->category_id;
     $options['group'] = SOCIAL_FIELDS_GROUP_EVENT;
     $fields = FD::model('fields')->getCustomFields($options);
     $registry = FD::registry();
     $disallowed = array(FD::token(), 'option', 'task', 'controller');
     foreach ($post as $key => $value) {
         if (!in_array($key, $disallowed)) {
             if (is_array($value)) {
                 $value = FD::json()->encode($value);
             }
             $registry->set($key, $value);
         }
     }
     $data = $registry->toArray();
     $fieldsLib = FD::fields();
     $args = array(&$data, &$event);
     $errors = $fieldsLib->trigger('onAdminEditValidate', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
     if (!empty($errors)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_FORM_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         JRequest::set($data, 'POST');
         return $view->call('form', $errors);
     }
     $errors = $fieldsLib->trigger('onAdminEditBeforeSave', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
     if (!empty($errors)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_FORM_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         JRequest::set($data, 'POST');
         return $view->call('form', $errors);
     }
     $event->bind($data);
     $event->save();
     if ($isNew) {
         $event->createOwner();
     }
     $args = array(&$data, &$event);
     $fieldsLib->trigger('onAdminEditAfterSave', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
     $event->bindCustomFields($data);
     $args = array(&$data, &$event);
     $fieldsLib->trigger('onAdminEditAfterSaveFields', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
     if ($isNew) {
         $event->createStream('create', $event->creator_uid, $event->creator_type);
     }
     // Jason: We do not want to create "update" stream if the edit occurs at backend?
     /*else {
     
                 // Only create if applyRecurring is false or event is not a child
                 // applyRecurring && parent = true
                 // applyRecurring && child = false
                 // !applyRecurring && parent = true
                 // !applyRecurring && child = true
                 if (empty($data['applyRecurring']) || !$event->isRecurringEvent()) {
                     $event->createStream('update', $my->id, SOCIAL_TYPE_USER);
                 }
             }*/
     $message = JText::_($isNew ? 'COM_EASYSOCIAL_EVENTS_FORM_CREATE_SUCCESS' : 'COM_EASYSOCIAL_EVENTS_FORM_UPDATE_SUCCESS');
     $view->setMessage($message, SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $task, $event);
 }
コード例 #6
0
ファイル: router.php プロジェクト: knigherrant/decopatio
 public static function tokenize($url, $xhtml = false, $ssl = null)
 {
     $url .= '&' . FD::token() . '=1';
     return FRoute::_($url, $xhtml, $ssl);
 }
コード例 #7
0
ファイル: groups.php プロジェクト: ppantilla/bbninja
 /**
  * Updates the group
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function update()
 {
     // Check for request forgeries
     FD::checkToken();
     // Only registered members allowed
     FD::requireLogin();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the group
     $id = JRequest::getInt('id');
     $group = FD::group($id);
     $my = FD::user();
     if (!$group->id || !$id) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Only allow user to edit if they have access
     if (!$group->isAdmin() && !$my->isSiteAdmin()) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_NO_ACCESS'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $group);
     }
     // Get post data.
     $post = JRequest::get('POST');
     // Get all published fields apps that are available in the current form to perform validations
     $fieldsModel = FD::model('Fields');
     // Only fetch relevant fields for this user.
     $options = array('group' => SOCIAL_TYPE_GROUP, 'uid' => $group->getCategory()->id, 'data' => true, 'dataId' => $group->id, 'dataType' => SOCIAL_TYPE_GROUP, 'visible' => SOCIAL_PROFILES_VIEW_EDIT);
     $fields = $fieldsModel->getCustomFields($options);
     // Load json library.
     $json = FD::json();
     // Initialize default registry
     $registry = FD::registry();
     // Get disallowed keys so we wont get wrong values.
     $disallowed = array(FD::token(), 'option', 'task', 'controller');
     // Process $_POST vars
     foreach ($post as $key => $value) {
         if (!in_array($key, $disallowed)) {
             if (is_array($value)) {
                 $value = $json->encode($value);
             }
             $registry->set($key, $value);
         }
     }
     // Convert the values into an array.
     $data = $registry->toArray();
     // Perform field validations here. Validation should only trigger apps that are loaded on the form
     // @trigger onRegisterValidate
     $fieldsLib = FD::fields();
     // Get the general field trigger handler
     $handler = $fieldsLib->getHandler();
     // Build arguments to be passed to the field apps.
     $args = array(&$data, &$group);
     // Ensure that there is no errors.
     // @trigger onEditValidate
     $errors = $fieldsLib->trigger('onEditValidate', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args, array($handler, 'validate'));
     // If there are errors, we should be exiting here.
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_PROFILE_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         // We need to set the proper vars here so that the es-wrapper contains appropriate class
         JRequest::setVar('view', 'groups', 'POST');
         JRequest::setVar('layout', 'edit', 'POST');
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('edit', $errors, $data);
     }
     // @trigger onEditBeforeSave
     $errors = $fieldsLib->trigger('onEditBeforeSave', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args, array($handler, 'beforeSave'));
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
         // We need to set the proper vars here so that the es-wrapper contains appropriate class
         JRequest::setVar('view', 'groups');
         JRequest::setVar('layout', 'edit');
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('edit', $errors);
     }
     // Save the group now
     $group->save();
     // @points: groups.update
     // Add points to the user that updated the group
     $my = FD::user();
     $points = FD::points();
     $points->assign('groups.update', 'com_easysocial', $my->id);
     // Reconstruct args
     $args = array(&$data, &$group);
     // @trigger onEditAfterSave
     $fieldsLib->trigger('onEditAfterSave', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args);
     // Bind custom fields for the user.
     $group->bindCustomFields($data);
     // Reconstruct args
     $args = array(&$data, &$group);
     // @trigger onEditAfterSaveFields
     $fieldsLib->trigger('onEditAfterSaveFields', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args);
     // Add stream item to notify the world that this user updated their profile.
     $group->createStream(FD::user()->id, 'update');
     $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_PROFILE_UPDATED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $group);
 }
コード例 #8
0
ファイル: profile.php プロジェクト: ppantilla/bbninja
 /**
  * Save user's information.
  *
  * @since	1.0
  * @access	public
  */
 public function save()
 {
     // Check for request forgeries.
     FD::checkToken();
     // Ensure that the user is registered
     FD::requireLogin();
     // Clear previous session
     $session = JFactory::getSession();
     $session->clear('easysocial.profile.errors', SOCIAL_SESSION_NAMESPACE);
     // Get post data.
     $post = JRequest::get('POST');
     // Get the current view.
     $view = $this->getCurrentView();
     // Get all published fields apps that are available in the current form to perform validations
     $fieldsModel = FD::model('Fields');
     // Get current user.
     $my = FD::user();
     // Only fetch relevant fields for this user.
     $options = array('profile_id' => $my->getProfile()->id, 'data' => true, 'dataId' => $my->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_EDIT, 'group' => SOCIAL_FIELDS_GROUP_USER);
     $fields = $fieldsModel->getCustomFields($options);
     // Load json library.
     $json = FD::json();
     // Initialize default registry
     $registry = FD::registry();
     // Get disallowed keys so we wont get wrong values.
     $disallowed = array(FD::token(), 'option', 'task', 'controller');
     // Process $_POST vars
     foreach ($post as $key => $value) {
         if (!in_array($key, $disallowed)) {
             if (is_array($value)) {
                 $value = $json->encode($value);
             }
             $registry->set($key, $value);
         }
     }
     // Convert the values into an array.
     $data = $registry->toArray();
     // Perform field validations here. Validation should only trigger apps that are loaded on the form
     // @trigger onRegisterValidate
     $fieldsLib = FD::fields();
     // Get the general field trigger handler
     $handler = $fieldsLib->getHandler();
     // Build arguments to be passed to the field apps.
     $args = array(&$data, &$my);
     // Ensure that there is no errors.
     // @trigger onEditValidate
     $errors = $fieldsLib->trigger('onEditValidate', SOCIAL_FIELDS_GROUP_USER, $fields, $args, array($handler, 'validate'));
     // If there are errors, we should be exiting here.
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         // We need to set the proper vars here so that the es-wrapper contains appropriate class
         JRequest::setVar('view', 'profile', 'POST');
         JRequest::setVar('layout', 'edit', 'POST');
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('edit', $errors, $data);
     }
     // @trigger onEditBeforeSave
     $errors = $fieldsLib->trigger('onEditBeforeSave', SOCIAL_FIELDS_GROUP_USER, $fields, $args, array($handler, 'beforeSave'));
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
         // We need to set the proper vars here so that the es-wrapper contains appropriate class
         JRequest::setVar('view', 'profile');
         JRequest::setVar('layout', 'edit');
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('edit', $errors);
     }
     // Bind the my object with appropriate data.
     $my->bind($data);
     // Save the user object.
     $my->save();
     // Reconstruct args
     $args = array(&$data, &$my);
     // @trigger onEditAfterSave
     $fieldsLib->trigger('onEditAfterSave', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     // Bind custom fields for the user.
     $my->bindCustomFields($data);
     // Reconstruct args
     $args = array(&$data, &$my);
     // @trigger onEditAfterSaveFields
     $fieldsLib->trigger('onEditAfterSaveFields', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     // Now we update the Facebook details if it is available
     $associatedFacebook = $this->input->get('associatedFacebook', 0, 'int');
     if (!empty($associatedFacebook)) {
         $facebookPull = $this->input->get('oauth_facebook_pull', null, 'default');
         $facebookPush = $this->input->get('oauth_facebook_push', null, 'default');
         $my = FD::user();
         $facebookTable = $my->getOAuth(SOCIAL_TYPE_FACEBOOK);
         if ($facebookTable) {
             $facebookTable->pull = $facebookPull;
             $facebookTable->push = $facebookPush;
             $facebookTable->store();
         }
     }
     // Add stream item to notify the world that this user updated their profile.
     $my->addStream('updateProfile');
     // Update indexer
     $my->syncIndex();
     // @points: profile.update
     // Assign points to the user when their profile is updated
     $points = FD::points();
     $points->assign('profile.update', 'com_easysocial', $my->id);
     // Prepare the dispatcher
     FD::apps()->load(SOCIAL_TYPE_USER);
     $dispatcher = FD::dispatcher();
     $args = array(&$user, &$fields, &$data);
     // @trigger: onUserProfileUpdate
     $dispatcher->trigger(SOCIAL_TYPE_USER, 'onUserProfileUpdate', $args);
     // @trigger onProfileCompleteCheck
     // This should return an array of booleans to state which field is filled in.
     // We count the returned result since it will be an array of trues that marks the field that have data for profile completeness checking.
     // We do this after all the data has been saved, and we reget the fields from the model again.
     // We also need to reset the cached field data
     SocialTableField::$_fielddata = array();
     $fields = $fieldsModel->getCustomFields(array('profile_id' => $my->getProfile()->id, 'data' => true, 'dataId' => $my->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_EDIT, 'group' => SOCIAL_FIELDS_GROUP_USER));
     $args = array(&$my);
     $completedFields = $fieldsLib->trigger('onProfileCompleteCheck', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     $table = FD::table('Users');
     $table->load(array('user_id' => $my->id));
     $table->completed_fields = count($completedFields);
     $table->store();
     $view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_ACCOUNT_UPDATED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $my);
 }
コード例 #9
0
 /**
  * Processes quick registrations
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function miniRegister()
 {
     FD::checkToken();
     // Get current user's info
     $session = JFactory::getSession();
     // Get necessary info about the current registration process.
     $registration = FD::table('Registration');
     $registration->load($session->getId());
     // Create a new object to store the params
     $params = new stdClass();
     // If registration values was previously set
     if (!empty($registration->values)) {
         $params = json_decode($registration->values);
     }
     // Get post values
     $post = JRequest::get('POST');
     // Keys to exclude
     $exclude = array(FD::token(), 'option', 'controller', 'task');
     // Go through each of the post vars
     foreach ($post as $key => $value) {
         if (!in_array($key, $exclude)) {
             if (is_array($value)) {
                 $value = json_encode($value);
             }
             $params->{$key} = $value;
         }
     }
     // Determines the mini registration mode
     $mode = $this->config->get('registrations.mini.mode', 'quick');
     // Determines the profile?
     $defaultProfile = $this->config->get('registrations.mini.profile', 'default');
     // Might be coming from module, in which we have to respect module settings
     if (isset($post['modRegisterType']) && isset($post['modRegisterProfile'])) {
         $mode = $post['modRegisterType'];
         $defaultProfile = $post['modRegisterProfile'];
     }
     // Get the default profile id that we should use.
     $profileModel = FD::model('Profiles');
     // If selected profile is default, then we check how many profiles are there
     if ($defaultProfile === 'default') {
         // We no longer allow the ability for user to select profile
         // This is because the rendered field might be different from user selected profile
         // Under that case, the mapping of the fields will be off and unable to validate/store accordingly
         // EG. Profile 1 has a password field with id 3, while Profile 2 has a password field id 5, if the rendered field is 3, but user selected profile 2, validation will fail because of field mismatch
         // Hence if the settings is set to default profile, then we always use default profile
         $defaultProfile = $profileModel->getDefaultProfile()->id;
     }
     // Set the profile id directly
     if (!empty($defaultProfile)) {
         $registration->profile_id = $defaultProfile;
         // Set the profile id in the params
         $params->profile_id = $defaultProfile;
         // Directly set the registration step as 1
         $registration->step = 1;
         $registration->addStepAccess(1);
     }
     // Convert the
     $registration->values = json_encode($params);
     // Store the registration
     $registration->store();
     // Decide what to do here based on the configuration
     // FULL -> Registration page, registration page then decides if there is 1 or more profile to choose
     // QUICK && profile id assigned -> quickRegistration
     // QUICK && no profile id -> Registration page with parameter quick=1
     // If mode is set to full, then we redirect to registration page
     if ($mode === 'full') {
         $this->view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATIONS_COMPLETE_REGISTRATION'), SOCIAL_MSG_INFO);
         return $this->view->call('fullRegister', $defaultProfile);
     }
     // If this is quick mode, we need to check whether there's a default profile
     if ($mode == 'quick' && !$defaultProfile) {
         return $this->view->call('selectProfile');
     }
     if ($mode == 'quick') {
         return $this->quickRegister();
     }
     return $this->view->call(__FUNCTION__);
 }
コード例 #10
0
ファイル: sidebar.php プロジェクト: knigherrant/decopatio
 /**
  * Returns a list of menus for the admin sidebar.
  *
  * Example:
  * <code>
  * <?php
  * $model 	= FD::model( 'Sidebar' );
  *
  * // Returns an array of menu items.
  * $model->getItems();
  * ?>
  * </code>
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	Array
  *
  * @author	Mark Lee <*****@*****.**>
  */
 public function getItems()
 {
     // @TODO: Configurable theme path for the back end.
     // Get the sidebar ordering from defaults first
     $defaults = SOCIAL_ADMIN_DEFAULTS . '/sidebar.json';
     $sidebarOrdering = FD::makeObject($defaults);
     if (!$sidebarOrdering) {
         return false;
     }
     $items = array();
     jimport('joomla.filesystem.folder');
     $path = SOCIAL_ADMIN_DEFAULTS . '/sidebar';
     $files = JFolder::files($path, '.json');
     foreach ($sidebarOrdering as $sidebarItem) {
         // Remove the reference from the $files array if it is defined in the ordering
         $index = array_search($sidebarItem . '.json', $files);
         if ($index !== false) {
             unset($files[$index]);
         }
         // Get the sidebar items in the defined order
         $content = FD::makeObject($path . '/' . $sidebarItem . '.json');
         if ($content !== false) {
             $items[] = $content;
         }
     }
     // Add any remaining files into items
     foreach ($files as $file) {
         $content = FD::makeObject($path . '/' . $file);
         if ($content !== false) {
             $items[] = $content;
         }
     }
     // If there are no items there, it should throw an error.
     if (!$items) {
         FD::logError(__FILE__, __LINE__, 'SIDEBAR: Unable to parse menu.json file.');
         return false;
     }
     // Initialize default result.
     $result = array();
     foreach ($items as $item) {
         // Generate a unique id.
         $uid = uniqid();
         // Generate a new group object for the sidebar.
         $obj = clone $item;
         // Assign the unique id.
         $obj->uid = $uid;
         // Initialize the counter
         $obj->count = 0;
         // Test if there's a counter key.
         if (isset($obj->counter)) {
             $namespace = explode('/', $obj->counter);
             $method = $namespace[1];
             $namespace = $namespace[0];
             $model = FD::model($namespace);
             $count = $model->{$method}();
             $obj->count = $count;
         }
         if (!empty($obj->childs)) {
             $childItems = array();
             usort($obj->childs, array('EasySocialModelSidebar', 'sortItems'));
             foreach ($obj->childs as $child) {
                 // Clone the child object.
                 $childObj = clone $child;
                 // Let's get the URL.
                 $url = array('index.php?option=com_easysocial');
                 $query = FD::makeArray($child->url);
                 // Set the url into the child item so that we can determine the active submenu.
                 $childObj->url = $child->url;
                 if ($query) {
                     foreach ($query as $queryKey => $queryValue) {
                         $url[] = $queryKey . '=' . $queryValue;
                         // If this is a call to the controller, it must have a valid token id.
                         if ($queryKey == 'controller') {
                             $url[] = FD::token() . '=1';
                         }
                     }
                 }
                 // Set the item link.
                 $childObj->link = implode('&amp;', $url);
                 // Initialize the counter
                 $childObj->count = 0;
                 // Check if there's any sql queries to execute.
                 if (isset($childObj->counter)) {
                     $namespace = explode('/', $childObj->counter);
                     $method = $namespace[1];
                     $namespace = $namespace[0];
                     $model = FD::model($namespace);
                     $count = $model->{$method}();
                     $childObj->count = $count;
                 }
                 // Add a unique id for the side bar for accordion purposes.
                 $childObj->uid = $uid;
                 // Add the menu item to the child items.
                 $childItems[] = $childObj;
             }
             $obj->childs = $childItems;
         }
         $result[] = $obj;
     }
     // @TODO: Render applications to see if they want to add any menu's here.
     return $result;
 }
コード例 #11
0
ファイル: users.php プロジェクト: ppantilla/bbninja
 /**
  * Stores the user object
  *
  * @since	1.0
  * @access	public
  */
 public function store()
 {
     // Check for request forgeries
     FD::checkToken();
     // Load front end's language file
     FD::language()->loadSite();
     // Get the current view
     $view = $this->getCurrentView();
     // Get the current task
     $task = $this->getTask();
     // Determine if this is an edited user.
     $id = JRequest::getInt('id');
     $id = !$id ? null : $id;
     // Get the posted data
     $post = JRequest::get('post');
     // this should come from backend user management page only.
     $autoApproval = isset($post['autoapproval']) ? $post['autoapproval'] : 0;
     // Create an options array for custom fields
     $options = array();
     if (!$id) {
         $user = new SocialUser();
         // Get the profile id
         $profileId = JRequest::getInt('profileId');
     } else {
         // Here we assume that the user record already exists.
         $user = FD::user($id);
         // Get the profile id from the user
         $profileId = $user->getProfile()->id;
         $options['data'] = true;
         $options['dataId'] = $id;
         $options['dataType'] = SOCIAL_TYPE_USER;
     }
     // Set the profile id
     $options['profile_id'] = $profileId;
     // Set the group
     $options['group'] = SOCIAL_FIELDS_GROUP_USER;
     // Load the profile
     $profile = FD::table('Profile');
     $profile->load($profileId);
     // Set the visibility
     $options['visible'] = SOCIAL_PROFILES_VIEW_EDIT;
     // Get fields model
     $fieldsModel = FD::model('Fields');
     // Get the custom fields
     $fields = $fieldsModel->getCustomFields($options);
     // Initialize default registry
     $registry = FD::registry();
     // Get disallowed keys so we wont get wrong values.
     $disallowed = array(FD::token(), 'option', 'task', 'controller', 'autoapproval');
     // Process $_POST vars
     foreach ($post as $key => $value) {
         if (!in_array($key, $disallowed)) {
             if (is_array($value)) {
                 $value = FD::json()->encode($value);
             }
             $registry->set($key, $value);
         }
     }
     // Test to see if the points has changed.
     $points = JRequest::getInt('points');
     // Lets get the difference of the points
     $userPoints = $user->getPoints();
     // If there is a difference, the admin may have altered the user points
     if ($userPoints != $points) {
         // Insert a new points record for this new adjustments.
         if ($points > $userPoints) {
             // If the result points is larger, we always need to subtract and get the balance.
             $totalPoints = $points - $userPoints;
         } else {
             // If the result points is smaller, we always need to subtract.
             $totalPoints = -($userPoints - $points);
         }
         $pointsLib = FD::points();
         $pointsLib->assignCustom($user->id, $totalPoints, JText::_('COM_EASYSOCIAL_POINTS_ADJUSTMENTS'));
         $user->points = $points;
     }
     // Convert the values into an array.
     $data = $registry->toArray();
     // Get the fields lib
     $fieldsLib = FD::fields();
     // Build arguments to be passed to the field apps.
     $args = array(&$data, &$user);
     // @trigger onAdminEditValidate
     $errors = $fieldsLib->trigger('onAdminEditValidate', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     // If there are errors, we should be exiting here.
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('form', $errors);
     }
     // @trigger onAdminEditBeforeSave
     $errors = $fieldsLib->trigger('onAdminEditBeforeSave', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     if (is_array($errors) && count($errors) > 0) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
         // We need to set the data into the post again because onEditValidate might have changed the data structure
         JRequest::set($data, 'post');
         return $view->call('form', $errors);
     }
     // Update the user's gid
     $gid = JRequest::getVar('gid');
     $data['gid'] = $gid;
     // Bind the user object with the form data.
     $user->bind($data);
     // Create a new user record if the id don't exist yet.
     if (!$id) {
         $model = FD::model('Users');
         $user = $model->create($data, $user, $profile);
         if (!$user) {
             $view->setMessage($model->getError(), SOCIAL_MSG_ERROR);
             // We need to set the data into the post again because onEditValidate might have changed the data structure
             JRequest::set($data, 'post');
             return $view->call('form');
         }
         if ($autoApproval) {
             // let approve this user. since this user created by admin, we dont need to notify the user.
             $user->approve(false);
         }
         // @TODO: Send email notifications
         $message = $autoApproval ? JText::_('COM_EASYSOCIAL_USERS_CREATED_SUCCESSFULLY_AND_APPROVED') : JText::_('COM_EASYSOCIAL_USERS_CREATED_SUCCESSFULLY');
     } else {
         // If this was an edited user, save the user object.
         $user->save();
         $message = JText::_('COM_EASYSOCIAL_USERS_USER_UPDATED_SUCCESSFULLY');
     }
     // Reconstruct args
     $args = array(&$data, &$user);
     // @trigger onEditAfterSave
     $fieldsLib->trigger('onAdminEditAfterSave', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     // Bind the custom fields for the user.
     $user->bindCustomFields($data);
     // Reconstruct args
     $args = array(&$data, &$user);
     // @trigger onEditAfterSaveFields
     $fieldsLib->trigger('onAdminEditAfterSaveFields', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     // Prepare the dispatcher
     FD::apps()->load(SOCIAL_TYPE_USER);
     $dispatcher = FD::dispatcher();
     $args = array(&$user, &$fields, &$data);
     // @trigger: onUserProfileUpdate
     $dispatcher->trigger(SOCIAL_TYPE_USER, 'onUserProfileUpdate', $args);
     // Process notifications
     if (isset($post['notifications']) && !empty($post['notifications'])) {
         $systemNotifications = $post['notifications']['system'];
         $emailNotifications = $post['notifications']['email'];
         // Store the notification settings for this user.
         $model = FD::model('Notifications');
         $model->saveNotifications($systemNotifications, $emailNotifications, $user);
     }
     // Process privacy items
     if (isset($post['privacy']) && !empty($post['privacy'])) {
         $resetPrivacy = isset($post['privacyReset']) ? true : false;
         $user->bindPrivacy($post['privacy'], $post['privacyID'], $post['privacyCustom'], $post['privacyOld'], $resetPrivacy);
     }
     $view->setMessage($message, SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $task, $user);
 }
コード例 #12
0
ファイル: view.html.php プロジェクト: knigherrant/decopatio
 /**
  * Post action after updating an event to redirect to appropriately.
  *
  * @author Jason Rey <*****@*****.**>
  * @since  1.3
  * @access public
  * @param  SocialEvent  $event  The SocialEvent object.
  */
 public function update($event = null)
 {
     // Recurring support
     // If applies to all, we need to show a "progress update" page to update all childs through ajax.
     $applyAll = !empty($event) && $event->hasRecurringEvents() && $this->input->getInt('applyRecurring');
     // Check if need to create recurring event
     $createRecurring = !empty($event->recurringData);
     // If no apply, and no recurring create, then redirect accordingly.
     if (!$applyAll && !$createRecurring) {
         FD::info()->set($this->getMessage());
         if ($this->hasErrors() || empty($event)) {
             return $this->redirect(FRoute::events());
         }
         return $this->redirect($event->getPermalink());
     }
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_EVENTS'), FRoute::events());
     FD::page()->breadcrumb($event->getName(), $event->getPermalink());
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_EDIT_EVENT'));
     FD::page()->title(JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_EDIT_EVENT_TITLE', $event->getName()));
     $post = JRequest::get('POST');
     $json = FD::json();
     $data = array();
     $disallowed = array(FD::token(), 'option', 'task', 'controller');
     foreach ($post as $key => $value) {
         if (in_array($key, $disallowed)) {
             continue;
         }
         if (is_array($value)) {
             $value = $json->encode($value);
         }
         $data[$key] = $value;
     }
     $string = $json->encode($data);
     $this->set('data', $string);
     $this->set('event', $event);
     $updateids = array();
     if ($applyAll) {
         $children = $event->getRecurringEvents();
         foreach ($children as $child) {
             $updateids[] = $child->id;
         }
     }
     $this->set('updateids', $json->encode($updateids));
     $schedule = array();
     if ($createRecurring) {
         // If there is recurring data, then we back up the post values and the recurring data in the the event params
         $clusterTable = FD::table('Cluster');
         $clusterTable->load($event->id);
         $eventParams = FD::makeObject($clusterTable->params);
         $eventParams->postdata = $data;
         $eventParams->recurringData = $event->recurringData;
         $clusterTable->params = FD::json()->encode($eventParams);
         $clusterTable->store();
         // Get the recurring schedule
         $schedule = FD::model('Events')->getRecurringSchedule(array('eventStart' => $event->getEventStart(), 'end' => $event->recurringData->end, 'type' => $event->recurringData->type, 'daily' => $event->recurringData->daily));
     }
     $this->set('schedule', $json->encode($schedule));
     echo parent::display('site/events/update');
 }
コード例 #13
0
ファイル: users.php プロジェクト: yalive/com_api-plugins
 /**
  * Function create easysocial profile.
  *
  * @return user obj
  */
 public function createEsprofile($log_user)
 {
     $obj = new stdClass();
     if (JComponentHelper::isEnabled('com_easysocial', true)) {
         $app = JFactory::getApplication();
         $epost = $app->input->get('fields', '', 'ARRAY');
         require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
         // Get all published fields apps that are available in the current form to perform validations
         $fieldsModel = FD::model('Fields');
         // Get current user.
         $my = FD::user($log_user);
         // Only fetch relevant fields for this user.
         $options = array('profile_id' => $my->getProfile()->id, 'data' => true, 'dataId' => $my->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_EDIT, 'group' => SOCIAL_FIELDS_GROUP_USER);
         $fields = $fieldsModel->getCustomFields($options);
         $epost = $this->create_field_arr($fields, $epost);
         // Load json library.
         $json = FD::json();
         // Initialize default registry
         $registry = FD::registry();
         // Get disallowed keys so we wont get wrong values.
         $disallowed = array(FD::token(), 'option', 'task', 'controller');
         // Process $_POST vars
         foreach ($epost as $key => $value) {
             if (!in_array($key, $disallowed)) {
                 if (is_array($value) && $key != 'es-fields-11') {
                     $value = $json->encode($value);
                 }
                 $registry->set($key, $value);
             }
         }
         // Convert the values into an array.
         $data = $registry->toArray();
         // Perform field validations here. Validation should only trigger apps that are loaded on the form
         // @trigger onRegisterValidate
         $fieldsLib = FD::fields();
         // Get the general field trigger handler
         $handler = $fieldsLib->getHandler();
         // Build arguments to be passed to the field apps.
         $args = array($data, &$my);
         // Ensure that there is no errors.
         // @trigger onEditValidate
         //$errors = $fieldsLib->trigger( 'onEditValidate' , SOCIAL_FIELDS_GROUP_USER , $fields , $args, array( $handler, 'validate' ) );
         // Bind the my object with appropriate data.
         $my->bind($data);
         // Save the user object.
         $sval = $my->save();
         // Reconstruct args
         $args = array(&$data, &$my);
         // @trigger onEditAfterSave
         $fieldsLib->trigger('onEditAfterSave', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
         // Bind custom fields for the user.
         $my->bindCustomFields($data);
         // Reconstruct args
         $args = array(&$data, &$my);
         // @trigger onEditAfterSaveFields
         $fieldsLib->trigger('onEditAfterSaveFields', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
         if ($sval) {
             $obj->success = 1;
             $obj->message = "profile created successfully";
         } else {
             $obj->success = 0;
             $obj->message = "Unable to create profile";
         }
     } else {
         $obj->success = 0;
         $obj->message = 'Easysocial not installed';
     }
     return $obj;
 }
コード例 #14
0
ファイル: events.php プロジェクト: knigherrant/decopatio
 /**
  * Update an event
  *
  * @since   1.3
  * @access  public
  * @param   string
  * @return
  */
 public function update()
 {
     // Check for request forgeries
     FD::checkToken();
     // Ensure that the user is logged in
     FD::requireLogin();
     // Get the event data
     $id = $this->input->get('id', 0, 'int');
     // Load up the event
     $event = FD::event($id);
     if (empty($event) || empty($event->id)) {
         $this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_INVALID_EVENT_ID'), SOCIAL_MSG_ERROR);
         return $this->view->call(__FUNCTION__);
     }
     if (!$event->isPublished()) {
         $this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_EVENT_UNAVAILABLE'), SOCIAL_MSG_ERROR);
         return $this->view->call(__FUNCTION__);
     }
     $guest = $event->getGuest($this->my->id);
     if (!$this->my->isSiteAdmin() && !$guest->isOwner() && !$event->isAdmin() && (!$event->isGroupEvent() || $event->isGroupEvent() && !$event->getGroup()->isOwner())) {
         $this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_NOT_ALLOWED_TO_EDIT_EVENT'), SOCIAL_MSG_ERROR);
         return $this->view->call(__FUNCTION__, $event);
     }
     $post = JRequest::get('POST');
     $json = FD::json();
     $data = array();
     $disallowed = array(FD::token(), 'option', 'task', 'controller');
     foreach ($post as $key => $value) {
         if (in_array($key, $disallowed)) {
             continue;
         }
         if (is_array($value)) {
             $value = $json->encode($value);
         }
         $data[$key] = $value;
     }
     $fieldsModel = FD::model('Fields');
     $fields = FD::model('Fields')->getCustomFields(array('group' => SOCIAL_TYPE_EVENT, 'uid' => $event->getCategory()->id, 'visible' => SOCIAL_EVENT_VIEW_EDIT, 'data' => true, 'dataId' => $event->id, 'dataType' => SOCIAL_TYPE_EVENT));
     $fieldsLib = FD::fields();
     $args = array(&$data, &$event);
     $errors = $fieldsLib->trigger('onEditValidate', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args, array($fieldsLib->getHandler(), 'validate'));
     if (!empty($errors)) {
         $this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
         JRequest::setVar('view', 'events', 'POST');
         JRequest::setVar('layout', 'edit', 'POST');
         JRequest::set($data, 'POST');
         return $this->view->call('edit', $errors);
     }
     $errors = $fieldsLib->trigger('onEditBeforeSave', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args, array($fieldsLib->getHandler(), 'beforeSave'));
     if (!empty($errors)) {
         $this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
         JRequest::setVar('view', 'events', 'POST');
         JRequest::setVar('layout', 'edit', 'POST');
         JRequest::set($data, 'POST');
         return $this->view->call('edit', $errors);
     }
     $event->save();
     FD::points()->assign('events.update', 'com_easysocial', $this->my->id);
     $fieldsLib->trigger('onEditAfterSave', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
     $event->bindCustomFields($data);
     $fieldsLib->trigger('onEditAfterSaveFields', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
     // Only create if applyRecurring is false or event is not a child
     // applyRecurring && parent = true
     // applyRecurring && child = false
     // !applyRecurring && parent = true
     // !applyRecurring && child = true
     if (empty($data['applyRecurring']) || !$event->isRecurringEvent()) {
         $event->createStream('update', $this->my->id, SOCIAL_TYPE_USER);
     }
     $this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_UPDATED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
     return $this->view->call(__FUNCTION__, $event);
 }
コード例 #15
0
ファイル: event.php プロジェクト: yalive/com_api-plugins
 public function createEvent()
 {
     $app = JFactory::getApplication();
     $log_user = JFactory::getUser($this->plugin->get('user')->id);
     $user = FD::user($log_user->id);
     $config = FD::config();
     //create group post structure
     $ev_data = array();
     $result = new stdClass();
     $valid = 1;
     $post['title'] = $app->input->post->get('title', null, 'STRING');
     $post['parmalink'] = $app->input->post->get('parmalink', null, 'STRING');
     $post['description'] = $app->input->post->get('description', null, 'STRING');
     $post['event_type'] = $app->input->post->get('event_type', 0, 'INT');
     $post['startDatetime'] = $app->input->post->get('startDatetime', null, 'string');
     $post['endDatetime'] = $app->input->post->get('endDatetime', null, 'string');
     $post['event_allday'] = $app->input->post->get('event_allday', 0, 'INT');
     $post['repeat'] = $app->input->post->get('repeat', array('type' => 'none', 'end' => null), 'ARRAY');
     $post['website'] = $app->input->post->get('website', 0, 'INT');
     $post['allowmaybe'] = $app->input->post->get('allowmaybe', 0, 'INT');
     $post['allownotgoingguest'] = $app->input->post->get('allownotgoingguest', 0, 'INT');
     $post['guestlimit'] = $app->input->post->get('guestlimit', 0, 'INT');
     $post['photo_albums'] = $app->input->post->get('photo_albums', 0, 'INT');
     $post['announcement'] = $app->input->post->get('announcement', 0, 'INT');
     $post['discussions'] = $app->input->post->get('discussions', 0, 'INT');
     $post['location'] = $app->input->post->get('location', null, 'STRING');
     $post['categoryId'] = $categoryId = $app->input->post->get('category_id', 0, 'INT');
     $post['group_id'] = $app->input->post->get('group_id', null, 'INT');
     $category = FD::table('EventCategory');
     $category->load($categoryId);
     $session = JFactory::getSession();
     $session->set('category_id', $category->id, SOCIAL_SESSION_NAMESPACE);
     $stepSession = FD::table('StepSession');
     $stepSession->load(array('session_id' => $session->getId(), 'type' => SOCIAL_TYPE_EVENT));
     $stepSession->session_id = $session->getId();
     $stepSession->uid = $category->id;
     $stepSession->type = SOCIAL_TYPE_EVENT;
     $stepSession->set('step', 1);
     $stepSession->addStepAccess(1);
     // Check the group access for event creation
     if (!empty($post['group_id'])) {
         $group = FD::group($post['group_id']);
         if (!$group->canCreateEvent()) {
             $result->success = 0;
             $result->message = JText::_('COM_EASYSOCIAL_EVENTS_NOT_ALLOWED_TO_CREATE_EVENT');
             return $result;
         }
         $stepSession->setValue('group_id', $post['group_id']);
     } else {
         // Check if there is a group id set in the session, if yes then remove it
         if (!empty($stepSession->values)) {
             $value = FD::makeObject($stepSession->values);
             unset($value->group_id);
             $stepSession->values = FD::json()->encode($value);
         }
     }
     $stepSession->store();
     //step 2 - create event
     $session = JFactory::getSession();
     $stepSession = FD::table('StepSession');
     $stepSession->load(array('session_id' => $session->getId(), 'type' => SOCIAL_TYPE_EVENT));
     $category = FD::table('EventCategory');
     $category->load($stepSession->uid);
     $sequence = $category->getSequenceFromIndex($stepSession->step, SOCIAL_EVENT_VIEW_REGISTRATION);
     //for api test purpose
     if (empty($sequence)) {
         $result->success = 0;
         $result->message = JText::_('COM_EASYSOCIAL_EVENTS_NO_VALID_CREATION_STEP');
         return $result;
     }
     // Load the steps and fields
     $step = FD::table('FieldStep');
     $step->load(array('uid' => $category->id, 'type' => SOCIAL_TYPE_CLUSTERS, 'sequence' => $sequence));
     $registry = FD::registry();
     $registry->load($stepSession->values);
     // Get the fields
     $fieldsModel = FD::model('Fields');
     $customFields = $fieldsModel->getCustomFields(array('step_id' => $step->id, 'visible' => SOCIAL_EVENT_VIEW_REGISTRATION));
     // Get from request
     //$files = JRequest::get('FILES');
     //$post  = JRequest::get('POST');
     $token = FD::token();
     $json = FD::json();
     $data = $this->createData($customFields, $post);
     //add post data in registry
     foreach ($data as $key => $value) {
         if ($key == $token) {
             continue;
         }
         if (is_array($value)) {
             $value = $json->encode($value);
         }
         $registry->set($key, $value);
     }
     $data = $registry->toArray();
     $args = array(&$data, &$stepSession);
     // Load up the fields library so we can trigger the field apps
     $fieldsLib = FD::fields();
     $callback = array($fieldsLib->getHandler(), 'validate');
     //$errors = $fieldsLib->trigger('onRegisterValidate', SOCIAL_FIELDS_GROUP_EVENT, $customFields, $args, $callback);
     $stepSession->values = $json->encode($data);
     $stepSession->store();
     /*        if (!empty($errors)) {
     			//error code for 
     
                 $stepSession->setErrors($errors);
     
                 $stepSession->store();
     
                 $this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
     
                 return $this->view->call(__FUNCTION__, $stepSession);
     
             }
     */
     $completed = $step->isFinalStep(SOCIAL_EVENT_VIEW_REGISTRATION);
     $stepSession->created = FD::date()->toSql();
     //~
     //~ $nextStep = $step->getNextSequence(SOCIAL_EVENT_VIEW_REGISTRATION);
     //~
     //~ if ($nextStep) {
     //~ $nextIndex = $stepSession->step + 1;
     //~ $stepSession->step = $nextIndex;
     //~ $stepSession->addStepAccess($nextIndex);
     //~ }
     $stepSession->store();
     // Here we assume that the user completed all the steps
     $eventsModel = FD::model('Events');
     // Create the new event
     $event = $eventsModel->createEvent($stepSession);
     if (!$event->id) {
         $errors = $eventsModel->getError();
         $result->success = 0;
         $result->message = $errors;
         return $result;
     }
     // Assign points to the user for creating event
     FD::points()->assign('events.create', 'com_easysocial', $log_user->id);
     // If there is recurring data, then we back up the session->values and the recurring data in the the event params first before deleting step session
     if (!empty($event->recurringData)) {
         $clusterTable = FD::table('Cluster');
         $clusterTable->load($event->id);
         $eventParams = FD::makeObject($clusterTable->params);
         $eventParams->postdata = FD::makeObject($stepSession->values);
         $eventParams->recurringData = $event->recurringData;
         $clusterTable->params = FD::json()->encode($eventParams);
         $clusterTable->store();
     }
     $stepSession->delete();
     if ($event->isPublished() && FD::config()->get('events.stream.create')) {
         $event->createStream('create', $event->creator_uid, $event->creator_type);
     }
     if ($event->id) {
         $result->success = 1;
         $result->event_id = $event->id;
         $result->message = "Event created successfully";
     }
     return $result;
 }
コード例 #16
0
ファイル: group.php プロジェクト: yalive/com_api-plugins
 function CreateGroup()
 {
     $app = JFactory::getApplication();
     $log_user = JFactory::getUser($this->plugin->get('user')->id);
     $user = FD::user($log_user->id);
     $config = FD::config();
     //create group post structure
     $grp_data = array();
     $result = new stdClass();
     $valid = 1;
     $title = $app->input->get('title', null, 'STRING');
     $parmalink = $app->input->get('parmalink', null, 'STRING');
     $description = $app->input->get('description', null, 'STRING');
     $type = $app->input->get('type', 0, 'INT');
     $categoryId = $app->input->get('category_id', 0, 'INT');
     $avtar_pth = '';
     $avtar_scr = '';
     $avtar_typ = '';
     $phto_obj = null;
     if (!empty($_FILES['file']['name'])) {
         $upload_obj = new EasySocialApiUploadHelper();
         //ckecking upload cover
         //$phto_obj = $upload_obj->uploadPhoto($log_user->id,'group');
         $phto_obj = $upload_obj->ajax_avatar($_FILES['file']);
         $avtar_pth = $phto_obj['temp_path'];
         $avtar_scr = $phto_obj['temp_uri'];
         $avtar_typ = 'upload';
         $avatar_file_name = $_FILES['file']['name'];
     }
     $cover_data = null;
     if (!empty($_FILES['cover_file']['name'])) {
         $upload_obj = new EasySocialApiUploadHelper();
         //ckecking upload cover
         $cover_data = $upload_obj->ajax_cover($_FILES['cover_file'], 'cover_file');
         //$phtomod	= FD::model( 'Photos' );
         //$cover_obj = $upload_obj->uploadCover($log_user->id,'group');
         //$cover_data = $phtomod->getMeta($cover_obj->id, SOCIAL_PHOTOS_META_PATH);
         //
     }
     //
     //check title
     if (empty($title) || $title == null) {
         $valid = 0;
         $result->status = 0;
         $result->message[] = "Invalid group name";
     }
     //check parmalink
     if (empty($parmalink) || $parmalink == null) {
         $valid = 0;
         $result->status = 0;
         $result->message[] = "Invalid parmalink";
     }
     //check description
     if (empty($description) || $description == null) {
         $valid = 0;
         $result->status = 0;
         $result->message[] = "Empty description not allowed";
     }
     //check group type
     if (empty($type) || $type == 0) {
         $valid = 0;
         $result->status = 0;
         $result->message[] = "Please Add group type";
     }
     if (!$valid) {
         return $result;
     } else {
         // create steps
         $db = FD::db();
         $group = FD::table('Group');
         FD::import('admin:/includes/group/group');
         $group = new SocialGroup();
         // Load front end's language file
         FD::language()->loadSite();
         $category = FD::table('GroupCategory');
         $category->load($categoryId);
         // Get the steps
         $stepsModel = FD::model('Steps');
         $steps = $stepsModel->getSteps($categoryId, SOCIAL_TYPE_CLUSTERS);
         // Get the fields
         $lib = FD::fields();
         $fieldsModel = FD::model('Fields');
         /*$post = $this->input->post->getArray();
         		$args = array(&$post, &$group, &$errors);*/
         // query written due to commented function not working
         $query = "SELECT a.id,a.unique_key\tFROM `#__social_fields` AS `a` \n\t\t\t\t\t\tLEFT JOIN `#__social_apps` AS `b` ON `b`.`id` = `a`.`app_id`\n\t\t\t\t\t\tLEFT JOIN `#__social_fields_steps` AS `d` ON `a`.`step_id` = `d`.`id` \n\t\t\t\t\t\tWHERE `a`.`step_id` = '" . $steps[0]->id . "' ORDER BY `d`.`sequence` ASC,`a`.`ordering` ASC";
         $db->setQuery($query);
         $field_ids = $db->loadAssocList();
         /*foreach ($steps as $step) {
         
         					if ($group->id) {
         						$step->fields 	= $fieldsModel->getCustomFields(array('step_id' => $step->id, 'data' => true, 'dataId' => $group->id, 'dataType' => SOCIAL_TYPE_GROUP));
         					}
         					else {
         						$step->fields 	= $fieldsModel->getCustomFields(array('step_id' => $step->id));
         					}
         
         					
         				}*/
         foreach ($field_ids as $field) {
             $grp_data['cid'][] = $field['id'];
             switch ($field['unique_key']) {
                 case 'HEADER':
                     break;
                 case 'TITLE':
                     $grp_data['es-fields-' . $field['id']] = $title;
                     break;
                 case 'PERMALINK':
                     $grp_data['es-fields-' . $field['id']] = $parmalink;
                     break;
                 case 'DESCRIPTION':
                     $grp_data['es-fields-' . $field['id']] = $description;
                     break;
                 case 'TYPE':
                     $grp_data['group_type'] = $type;
                     break;
                 case 'URL':
                     $grp_data['es-fields-' . $field['id']] = $app->input->get('website', 0, 'STRING');
                     break;
                 case 'PHOTOS':
                     $grp_data['photo_albums'] = $app->input->get('photo_album', 0, 'INT');
                     break;
                 case 'NEWS':
                     $grp_data['es-fields-' . $field['id']] = $app->input->get('announcements', 0, 'INT');
                     break;
                 case 'DISCUSSIONS':
                     $grp_data['es-fields-' . $field['id']] = $app->input->get('discussions', 0, 'INT');
                     break;
                 case 'AVATAR':
                     $grp_data['es-fields-' . $field['id']] = array('source' => $avtar_scr, 'path' => $avtar_pth, 'data' => '', 'type' => $avtar_typ, 'name' => $avatar_file_name);
                     break;
                 case 'COVER':
                     $grp_data['es-fields-' . $field['id']] = array('data' => $cover_data, 'position' => '{"x":0.5,"y":0.5}');
                     break;
             }
         }
         //for check group exceed limit
         if (!$user->getAccess()->allowed('groups.create') && !$user->isSiteAdmin()) {
             $valid = 0;
             $result->status = 0;
             $result->message[] = "You are not allow to create the group";
             return $result;
         }
         // Ensure that the user did not exceed their group creation limit
         if ($user->getAccess()->intervalExceeded('groups.limit', $user->id) && !$user->isSiteAdmin()) {
             $valid = 0;
             $result->status = 0;
             $result->message[] = "Group creation limit exceeds";
             return $result;
         }
         // Get current user's info
         $session = JFactory::getSession();
         // Get necessary info about the current registration process.
         $stepSession = FD::table('StepSession');
         $stepSession->load($session->getId());
         $stepSession->uid = $categoryId;
         // Load the group category
         $category = FD::table('GroupCategory');
         $category->load($stepSession->uid);
         $sequence = $category->getSequenceFromIndex($stepSession->step, SOCIAL_GROUPS_VIEW_REGISTRATION);
         // Load the current step.
         $step = FD::table('FieldStep');
         $step->load(array('uid' => $category->id, 'type' => SOCIAL_TYPE_CLUSTERS, 'sequence' => $sequence));
         // Merge the post values
         $registry = FD::get('Registry');
         $registry->load($stepSession->values);
         // Load up groups model
         $groupsModel = FD::model('Groups');
         // Get all published fields apps that are available in the current form to perform validations
         $fieldsModel = FD::model('Fields');
         $fields = $fieldsModel->getCustomFields(array('step_id' => $step->id, 'visible' => SOCIAL_GROUPS_VIEW_REGISTRATION));
         // Load json library.
         $json = FD::json();
         // Retrieve all file objects if needed
         //$files 		= JRequest::get( 'FILES' );
         $token = FD::token();
         $disallow = array($token, 'option', 'cid', 'controller', 'task', 'option', 'currentStep');
         foreach ($grp_data as $key => $value) {
             if (!in_array($key, $disallow)) {
                 if (is_array($value)) {
                     $value = FD::json()->encode($value);
                 }
                 $registry->set($key, $value);
             }
         }
         // Convert the values into an array.
         $data = $registry->toArray();
         $args = array(&$data, &$stepSession);
         // Perform field validations here. Validation should only trigger apps that are loaded on the form
         // @trigger onRegisterValidate
         $fieldsLib = FD::fields();
         // Get the trigger handler
         $handler = $fieldsLib->getHandler();
         // Get error messages
         $errors = $fieldsLib->trigger('onRegisterValidate', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args, array($handler, 'validate'));
         // The values needs to be stored in a JSON notation.
         $stepSession->values = $json->encode($data);
         $stepSession->created = FD::date()->toMySQL();
         $group = $groupsModel->createGroup($stepSession);
         if ($group->id) {
             $result->status = 1;
             $result->id = $group->id;
             $this->addTostream($user, $group);
         } else {
             $result->status = 0;
             $result->id = 0;
             $result->message = 'unable to create group';
         }
         return $result;
     }
 }
コード例 #17
0
?>
</span>
	<i class="ies-arrow-down ies-small"></i>
</a>

<ul class="dropdown-menu dropdown-arrow-topleft dropdown-friends" data-profileFriends-dropdown>
	<li data-friends-response-approve>
		<a href="javascript:void(0);"><?php 
echo JText::_('COM_EASYSOCIAL_FRIENDS_APPROVE_FRIEND_REQUEST');
?>
</a>
		<form name="respondFriend" id="respondFriend" style="display: none;">
			<input type="hidden" name="option" value="com_easysocial" />
			<input type="hidden" name="controller" value="friends" />
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="id" value="" />
			<input type="hidden" name="return" value="" />
			<input type="hidden" name="<?php 
echo FD::token();
?>
" value="1" />
		</form>
	</li>
	<li data-friends-response-reject>
		<a href="javascript:void(0);"><?php 
echo JText::_('COM_EASYSOCIAL_FRIENDS_REJECT_FRIEND_REQUEST');
?>
</a>
	</li>
</ul>
コード例 #18
0
ファイル: themes.php プロジェクト: knigherrant/decopatio
 /**
  * Stores the theme parameter
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function store()
 {
     // Check for request forgeries
     FD::checkToken();
     // @TODO: Check if the user has privilege to access this section.
     // Get the element from the query
     $element = JRequest::getWord('element', '');
     // Get the current view
     $view = $this->getCurrentView();
     if (!$element) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_THEMES_INVALID_ELEMENT_PROVIDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $this->getTask());
     }
     // Load the model
     $model = FD::model('Themes');
     // Format through all the properties that we want to save here.
     $data = JRequest::get('post');
     // Remove unwanted stuffs from the post data.
     unset($data[FD::token()]);
     unset($data['option']);
     unset($data['controller']);
     unset($data['task']);
     unset($data['element']);
     $state = $model->update($element, $data);
     if (!$state) {
         $view->setMessage($model->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $this->getTask(), $element);
     }
     $view->setMessage(JText::sprintf('COM_EASYSOCIAL_THEMES_SETTINGS_SAVED_SUCCESS', $element), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $this->getTask(), $element);
 }
コード例 #19
0
ファイル: settings.php プロジェクト: BetterBetterBetter/B3App
 /**
  * Processes the saving of the settings.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @author	Mark Lee <*****@*****.**>
  */
 public function save()
 {
     // Check for request forgeries.
     FD::checkToken();
     // Since there are more than 1 tasks are linked here, get the appropriate task here.
     $task = $this->getTask();
     $method = $task;
     $page = JRequest::getVar('page', '');
     $view = FD::view('Settings');
     // Get the posted data.
     $post = JRequest::get('POST');
     // Only load the config that is already stored.
     // We don't want to store everything as we want to have hidden settings.
     $configTable = FD::table('Config');
     $config = FD::registry();
     if ($configTable->load('site')) {
         $config->load($configTable->value);
     }
     $token = FD::token();
     if (!$post) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_INVALID_POST_DATA'), SOCIAL_MSG_ERROR);
         return $view->call($method, $page);
     }
     // Some post vars are unwanted / unecessary because of the hidden inputs.
     $ignored = array('task', 'option', 'controller', 'view', $token, 'page');
     $updatedUserIndexing = false;
     foreach ($post as $key => $value) {
         if (!in_array($key, $ignored)) {
             // Replace all _ with .
             $key = str_ireplace('_', '.', $key);
             // If the value is an array, and there's only 1 index,
             // the input might need to be checked if it needs to be in an array form.
             // E.g: some,values,here,should,be,an,array
             if (is_array($value) && count($value) == 1) {
                 $value = FD::makeArray($value[0], ',');
             }
             if ($key == 'users.indexer.name' || $key == 'users.indexer.email') {
                 $previousVal = $config->get($key);
                 if ($previousVal != $value) {
                     $updatedUserIndexing = true;
                 }
             }
             $config->set($key, $value);
         }
     }
     // Convert the config object to a json string.
     $jsonString = $config->toString();
     $configTable = FD::table('Config');
     if (!$configTable->load('site')) {
         $configTable->type = 'site';
     }
     $configTable->set('value', $jsonString);
     // Try to store the configuration.
     if (!$configTable->store()) {
         $view->setMessage($configTable->getError(), SOCIAL_MSG_ERROR);
         return $view->call($method, $page);
     }
     // Check if any of the configurations are stored as non local
     if (($config->get('storage.photos') == 'amazon' || $config->get('storage.conversations') == 'amazon') && $config->get('storage.amazon.bucket') == '') {
         // Initialize the storage
         $bucket = FD::storage('Amazon')->init();
         $config->set('storage.amazon.bucket', $bucket);
         $configTable->set('value', $config->toString());
         $configTable->store();
     }
     $message = $updatedUserIndexing ? JText::_('COM_EASYSOCIAL_SETTINGS_SAVED_SUCCESSFULLY_WITH_USER_INDEXING_UPDATED') : JText::_('COM_EASYSOCIAL_SETTINGS_SAVED_SUCCESSFULLY');
     $view->setMessage($message, SOCIAL_MSG_SUCCESS);
     return $view->call($method, $page);
 }
コード例 #20
0
ファイル: view.html.php プロジェクト: knigherrant/decopatio
 /**
  * Post action after storing an event to redirect to the appropriate page according to the task.
  *
  * @author Jason Rey <*****@*****.**>
  * @since  1.3
  * @access public
  * @param  string       $task   The task action.
  * @param  SocialEvent  $event  The event object.
  */
 public function store($task, $event)
 {
     // Recurring support
     // If applies to all, we need to show a "progress update" page to update all childs through ajax.
     $applyAll = $event->hasRecurringEvents() && $this->input->getInt('applyRecurring');
     // Check if need to create recurring event
     $createRecurring = !empty($event->recurringData);
     if (!$applyAll && !$createRecurring) {
         FD::info()->set($this->getMessage());
         if ($task === 'apply') {
             $activeTab = JRequest::getWord('activeTab', 'event');
             return $this->redirect(FRoute::url(array('view' => 'events', 'layout' => 'form', 'id' => $event->id, 'activeTab' => $activeTab)));
         }
         if ($task === 'savenew') {
             return $this->redirect(FRoute::url(array('view' => 'events', 'layout' => 'form', 'category_id' => $event->category_id)));
         }
         return $this->redirect(FRoute::url(array('view' => 'events')));
     }
     $this->setHeading('COM_EASYSOCIAL_EVENTS_APPLYING_RECURRING_EVENT_CHANGES');
     $this->setDescription('COM_EASYSOCIAL_EVENTS_APPLYING_RECURRING_EVENT_CHANGES_DESCRIPTION');
     $post = JRequest::get('POST');
     $json = FD::json();
     $data = array();
     $disallowed = array(FD::token(), 'option', 'task', 'controller');
     foreach ($post as $key => $value) {
         if (in_array($key, $disallowed)) {
             continue;
         }
         if (is_array($value)) {
             $value = $json->encode($value);
         }
         $data[$key] = $value;
     }
     $string = $json->encode($data);
     $this->set('data', $string);
     $this->set('event', $event);
     $updateids = array();
     if ($applyAll) {
         $children = $event->getRecurringEvents();
         foreach ($children as $child) {
             $updateids[] = $child->id;
         }
     }
     $this->set('updateids', $json->encode($updateids));
     $schedule = array();
     if ($createRecurring) {
         // Get the recurring schedule
         $schedule = FD::model('Events')->getRecurringSchedule(array('eventStart' => $event->getEventStart(), 'end' => $event->recurringData->end, 'type' => $event->recurringData->type, 'daily' => $event->recurringData->daily));
     }
     $this->set('schedule', $json->encode($schedule));
     $this->set('task', $task);
     return parent::display('admin/events/store');
 }