Example #1
0
 /**
  * Initialize and create an object.
  *
  * <code>
  * $options = array(
  *  "order_column" => "title", // id or title
  *  "order_direction" => "DESC",
  * );
  *
  * $types    = CrowdFundingTypes::getInstance(JFactory::getDbo(), $options);
  * </code>
  *
  * @param JDatabaseDriver $db
  * @param array $options
  *
  * @return self
  */
 public static function getInstance(JDatabaseDriver $db, $options = array())
 {
     if (is_null(self::$instance)) {
         self::$instance = new CrowdFundingTypes($db);
         self::$instance->load($options);
     }
     return self::$instance;
 }
Example #2
0
 protected function prepareBasic()
 {
     $model = JModelLegacy::getInstance("Project", "CrowdFundingModel", $config = array('ignore_request' => false));
     /** @var $model CrowdFundingModelProject */
     // Get state
     /** @var  $state Joomla\Registry\Registry */
     $state = $model->getState();
     $this->state = $state;
     // Get params
     /** @var  $params Joomla\Registry\Registry */
     $params = $this->state->get("params");
     $this->params = $params;
     // Get item
     $itemId = $this->state->get('project.id');
     $this->item = $model->getItem($itemId, $this->userId);
     // Set a flag that describes the item as new.
     $this->isNew = false;
     if (!$this->item->id) {
         $this->isNew = true;
     }
     $this->form = $model->getForm();
     // Get types
     jimport("crowdfunding.types");
     $types = CrowdFundingTypes::getInstance(JFactory::getDbo());
     $this->numberOfTypes = count($types);
     // Prepare images
     $this->imageFolder = $this->params->get("images_directory", "images/crowdfunding");
     $this->imageSmall = $this->item->get("image_small");
     $this->pathwayName = JText::_("COM_CROWDFUNDING_STEP_BASIC");
 }