コード例 #1
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('safmodules');
     $id = new Zend_Form_Element_Hidden('id');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $label = new Zend_Form_Element_Text('label');
     $label->setLabel('label');
     $image = new Zend_Form_Element_Text('image');
     $image->setLabel('Picto path');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('Description');
     $usersGroupsId = new Zend_Form_Element_Select('usersgroups_id');
     $options = new Usersgroups();
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $usersGroupsId->addMultiOption($k, $v['mlabel']);
     }
     $usersGroupsId->setLabel('usersgroups_id');
     $prefix = new Zend_Form_Element_Text('prefix');
     $prefix->setLabel('Prefix');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Technical Name');
     $showintab = new Zend_Form_Element_Text('showintab');
     $showintab->setLabel('Show in tab?');
     $istechnical = new Zend_Form_Element_Text('istechnical');
     $istechnical->setLabel('Is technical only?');
     $order = new Zend_Form_Element_Text('order');
     $order->setLabel('Order');
     $isalwaysactive = new Zend_Form_Element_Text('isalwaysactive');
     $isalwaysactive->setLabel('Is always active?');
     $longdesc = new Zend_Form_Element_Textarea('longdesc');
     $longdesc->setLabel('Long description');
     $fileFoldersId = new Zend_Form_Element_Select('filfolders_id');
     $options = new Filfolders();
     $fileFoldersId->addMultiOption('', '----------');
     foreach ($options->fetchAll("safinstances_id = '" . $this->safinstancesid . "' ") as $k => $v) {
         $fileFoldersId->addMultiOption($v->id, $v->label);
     }
     $fileFoldersId->setLabel('Image category');
     $safinstancesTypeId = new Zend_Form_Element_Select('safinstancestype_id');
     $options = new Safinstancestype();
     $safinstancesTypeId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $safinstancesTypeId->addMultiOption($k, $v['mlabel']);
     }
     $safinstancesTypeId->setLabel('safinstancestype_id');
     $this->addElements(array($id, $label, $safinstancesTypeId, $image, $fileFoldersId, $description, $longdesc, $usersGroupsId, $prefix, $name, $showintab, $istechnical, $order, $isalwaysactive));
     $this->addElements(array($submit));
 }
コード例 #2
0
 /**
  * Returns the folders linked to a file
  * @param int $filfilesId
  * @param boolean $json Return data in a JSON string containing the ids and labels
  * @return string
  */
 protected function _getLinkedFolders($filfilesId, $json = true)
 {
     $elements = array();
     $lDB = new FilfoldersFilfiles();
     $fDB = new Filfolders();
     $fileFilesIds = $lDB->getFilfoldersLinkedTo($filfilesId);
     if (count($fileFilesIds) > 0) {
         $sql = "id IN (" . implode(',', $fileFilesIds) . ")  ";
         foreach ($fDB->fetchAll($sql) as $el) {
             $elements[] = array('label' => addslashes($el->label), 'val' => $el->id);
         }
     }
     if ($json) {
         return preg_replace('/"/', "'", Zend_Json::encode($elements));
     } else {
         return $elements;
     }
 }
コード例 #3
0
ファイル: FilfilesOp.php プロジェクト: Cryde/sydney-core
 /**
  * Returns an array of IDs and Names of the categories linked to this file
  * not taking into account the safinstance linked to this file
  * (this is useful for images displayed in people that can be shared trough multiple instances)
  *
  * @param $id
  * @return Array
  */
 public function getCategoriesLabels($id)
 {
     $categoryDB = new FilfoldersFilfiles();
     $foldersDb = new Filfolders();
     $idString = implode(',', $categoryDB->getFilfoldersLinkedTo($id));
     if ($idString != '') {
         $where = "id IN (" . $idString . ") ";
     } else {
         return array();
     }
     $toRetun = array();
     foreach ($foldersDb->fetchAll($where) as $element) {
         $toRetun[$element['id']] = $element['label'];
     }
     return $toRetun;
 }