示例#1
0
 /**
  * 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.project.data', array());
     if (empty($data)) {
         $data = $this->getItem();
         if (!empty($data->location_id)) {
             // Load location from database.
             $location = new Crowdfunding\Location(JFactory::getDbo());
             $location->load($data->location_id);
             $locationName = $location->getName(true);
             // Set the name to the form element.
             if (!empty($locationName)) {
                 $data->location_preview = $locationName;
             }
         }
     }
     return $data;
 }
示例#2
0
 /**
  * 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 . '.edit.project.data', array());
     if (!$data) {
         $itemId = (int) $this->getState($this->getName() . '.id');
         $userId = JFactory::getUser()->get("id");
         $data = $this->getItem($itemId, $userId);
         if (!empty($data->location_id)) {
             // Load location from database.
             $location = new Crowdfunding\Location(JFactory::getDbo());
             $location->load($data->location_id);
             $locationName = $location->getName(true);
             // Set the name to the form element.
             if (!empty($locationName)) {
                 $data->location_preview = $locationName;
             }
         }
     }
     return $data;
 }