Example #1
0
 /**
  * Set the title for the store. This will be outputted in the JSON response.
  * 
  * Should be called in \GO\Base\Controller\AbstractModelController::beforeStoreStatement
  * 
  * @param \GO\Base\Data\AbstractStore $store
  * @param string $titleAttribute 
  */
 public function setStoreTitle($titleAttribute = 'name')
 {
     //		$titleArray = array();
     //		$models = $this->_getSelectedModels();
     //		foreach ($models as $model)
     //			$titleArray[] = $model->$titleAttribute;
     //
     //		if(count($titleArray))
     //			$this->_store->setTitle(implode(', ',$titleArray));
     $count = count($this->selectedIds);
     if ($count == 1) {
         $model = \GO::getModel($this->_modelName)->findByPk($this->selectedIds[0]);
         if (isset($model->name)) {
             $this->_store->setTitle($model->name);
         }
     } else {
         $this->_store->setTitle($count . ' ' . \GO::t('multiselectSelected'));
     }
 }