예제 #1
0
파일: profile.php 프로젝트: pashakiz/crowdf
 /**
  * Method to get the data that should be injected in the form.
  *
  * @return  mixed   The data for the form.
  * @since   1.6
  */
 protected function loadFormData()
 {
     // Check the session for previously entered form data.
     $data = JFactory::getApplication()->getUserState($this->option . '.edit.profile.data', array());
     if (empty($data)) {
         $data = $this->getItem();
         if (!empty($data->id)) {
             // Prepare social profiles
             $socialProfiles = $this->getSocialProfiles($data->id);
             if (!empty($socialProfiles)) {
                 foreach ($socialProfiles as $item) {
                     $data->{$item}["type"] = $item["alias"];
                 }
             }
             // Prepare locations
             if (!empty($data->location_id)) {
                 $location = new SocialCommunity\Location(JFactory::getDbo());
                 $location->load($data->location_id);
                 $locationName = $location->getName(SocialCommunity\Constants::INCLUDE_COUNTRY_CODE);
                 if (!empty($locationName)) {
                     $data->location_preview = $locationName;
                 }
             }
         }
     }
     return $data;
 }
예제 #2
0
파일: contact.php 프로젝트: pashakiz/crowdf
 /**
  * Method to get the data that should be injected in the form.
  *
  * @return    mixed    The data for the form.
  * @since    1.6
  */
 protected function loadFormData()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $data = $app->getUserState($this->option . '.profile.contact', array());
     if (!$data) {
         $data = $this->getItem();
         if (!empty($data["location_id"])) {
             $location = new SocialCommunity\Location(JFactory::getDbo());
             $location->load(array("id" => $data["location_id"]));
             $locationName = $location->getName(SocialCommunity\Constants::INCLUDE_COUNTRY_CODE);
             if (!empty($locationName)) {
                 $data["location_preview"] = $locationName;
             }
         }
     }
     return $data;
 }