Example #1
0
 /**
  * Class constructor
  *
  * @return void
  */
 public function __construct($options)
 {
     parent::__construct($options);
     $imageSrc = $options['imageSrc'];
     if (isset($options['imgField'])) {
         $imgField = $options['imgField'];
     }
     $dataId = $options['dataId'];
     $isNewImage = $options['isNewImage'];
     $moduleName = $options['moduleName'];
     if ($dataId == '') {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp";
     } else {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp";
     }
     $config = Zend_Registry::get('config');
     // hidden specify if new image for the news
     $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage));
     $newImage->removeDecorator('Label');
     $this->addElement($newImage);
     // Name of the product line
     $name = new Zend_Form_Element_Text('CCI_Name');
     $name->setLabel($this->getView()->getCibleText('form_category_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput ');
     $label = $name->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $this->addElement($name);
     if (!empty($imgField)) {
         // Image for the category
         $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp');
         $imageTmp->removeDecorator('Label');
         $this->addElement($imageTmp);
         $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original');
         $imageOrg->removeDecorator('Label');
         $this->addElement($imageOrg);
         $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;'));
         $imageView->setImage($imageSrc);
         $this->addElement($imageView);
         $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId));
         $imagePicker->setLabel($this->getView()->getCibleText('form_category_logo_label'));
         $this->addElement($imagePicker);
     }
     // ImageSrc
     $imageBanner = new Zend_Form_Element_Select('C_BannerGroupID');
     $imageBanner->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class', 'stdSelect');
     $imageBanner->addMultiOption('', 'Sans image');
     $group = new GroupObject();
     $groupArray = $group->groupCollection();
     foreach ($groupArray as $group1) {
         $imageBanner->addMultiOption($group1['BG_ID'], $group1['BG_Name']);
     }
     $this->addElement($imageBanner);
     // id of the associated meta data
     $metaTagId = new Zend_Form_Element_Hidden('CCI_MetaId');
     $metaTagId->removeDecorator('Label');
     $this->addElement($metaTagId);
 }
Example #2
0
 public function __set($param, $value)
 {
     if ($param == "label") {
         $group = new GroupObject();
         if ($group->load_by_label($value)) {
             throw new Exception_Database_Exists();
         }
     }
     parent::__set($param, $value);
 }
Example #3
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $imageSrc = $options['imageSrc'];
     $dataId = $options['dataId'];
     $imgField = $options['imgField'];
     $isNewImage = $options['isNewImage'];
     $moduleName = $options['moduleName'];
     if ($dataId == '') {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp";
     } else {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp";
     }
     // hidden specify if new image for the news
     $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage));
     $newImage->removeDecorator('Label');
     $this->addElement($newImage);
     // Image for the product line
     $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp');
     $imageTmp->removeDecorator('Label');
     $this->addElement($imageTmp);
     $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original');
     $imageOrg->removeDecorator('Label');
     $this->addElement($imageOrg);
     // Name of the group of banner
     // Set the texte for the image
     $textDescription = new Zend_Form_Element_Textarea('BII_Text');
     $textDescription->setLabel($this->_view->getCibleText('form_banner_image_text_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea');
     $label = $textDescription->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $textUrl = new Zend_Form_Element_Text('BII_Url');
     $textUrl->setLabel($this->_view->getCibleText('form_banner_image_texturl_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdText');
     $label = $textUrl->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $groupImage = new Zend_Form_Element_Select('BI_GroupID');
     $groupImage->setLabel($this->_view->getCibleText('form_banner_image_group'))->setAttrib('class', 'largeSelect');
     $group = new GroupObject();
     $groupArray = $group->groupCollection();
     foreach ($groupArray as $group1) {
         $groupImage->addMultiOption($group1['BG_ID'], $group1['BG_Name']);
     }
     $label = $groupImage->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     // Image for the product line
     $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;'));
     $imageView->setImage($imageSrc);
     $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId));
     $imagePicker->removeDecorator('Label');
     $this->addElement($imageView);
     $this->addElement($imagePicker);
     $this->addElement($groupImage);
     $this->addElement($textDescription);
     $this->addElement($textUrl);
 }
Example #4
0
 public static function create($name, $id = null)
 {
     $g = new GroupObject();
     try {
         if ($id != null) {
             $g->gid = $id;
         }
         $g->label = $name;
         $g->save();
     } catch (Exception_Database_Exists $e) {
         return false;
     }
     $g->load_by_label($name);
     method_invoke_all("hook_group_create", array($g->gid));
     return true;
 }
Example #5
0
 /**
  * Class constructor
  *
  * @return void
  */
 public function __construct($options)
 {
     parent::__construct($options);
     $imageSrc = $options['imageSrc'];
     $dataId = $options['dataId'];
     $isNewImage = $options['isNewImage'];
     $moduleName = $options['moduleName'];
     if ($dataId == '') {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp";
     } else {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp";
     }
     $config = Zend_Registry::get('config');
     // Name of the product line
     $name = new Zend_Form_Element_Text('SCI_Name');
     $name->setLabel($this->getView()->getCibleText('form_subcategory_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput ');
     $label = $name->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $this->addElement($name);
     $oCategories = new CatalogCategoriesObject();
     $listCat = $oCategories->getAll(Zend_Registry::get('currentEditLanguage'));
     $categories = new Zend_Form_Element_Select('SC_CategoryID');
     $categories->setLabel($this->getView()->getCibleText('form_select_category_label'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'largeSelect');
     $categories->addMultiOption('', $this->getView()->getCibleText('form_select_default_label'));
     foreach ($listCat as $data) {
         $categories->addMultiOption($data['CC_ID'], $data['CCI_Name']);
     }
     $this->addElement($categories);
     // ImageSrc
     $imageBanner = new Zend_Form_Element_Select('SC_BannerGroupID');
     $imageBanner->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class', 'stdSelect');
     $imageBanner->addMultiOption('', 'Sans image');
     $group = new GroupObject();
     $groupArray = $group->groupCollection();
     foreach ($groupArray as $group1) {
         $imageBanner->addMultiOption($group1['BG_ID'], $group1['BG_Name']);
     }
     $this->addElement($imageBanner);
     // id of the associated meta data
     $metaTagId = new Zend_Form_Element_Hidden('SCI_MetaId');
     $metaTagId->removeDecorator('Label');
     $this->addElement($metaTagId);
 }
Example #6
0
 public function creategroup()
 {
     $forbidden = array("create");
     if (isset($_POST['group_name'])) {
         $cname = strtolower($_POST['group_name']);
         if (in_array($cname, $forbidden)) {
             header("Location:" . Page::url("/admin/groups?err=reserved"));
         }
         $group = new GroupObject();
         if ($group->load_by_label($cname)) {
             header("Location:" . Page::url("/admin/groups?err=exists"));
         } else {
             $group->label = $cname;
             $group->save();
             header("Location:" . Page::url("/admin/groups"));
         }
     }
     header("Location:" . Page::url("/admin/groups?err=unknown"));
 }
Example #7
0
 public function permissions($permission)
 {
     if (strtolower($permission) == "full access") {
         return true;
     }
     $s = new stdClass();
     $s->gid = 1;
     $groups = array($s);
     if (User::get_user_logged_id() == 1) {
         return true;
     }
     if (User::get_user_logged_id() != null) {
         $groups = GroupObject::GetAllGroupsMembership(User::get_user_logged_id());
     }
     $p = new PermissionObject();
     if ($p->loadByName($permission)) {
         foreach ($groups as $g) {
             if ($p->groupIsAllowed($g->gid)) {
                 return true;
             }
         }
     }
     return false;
 }
Example #8
0
    public function __construct($options = null)
    {
        $baseDir = $options['baseDir'];
        $pageID = $options['pageID'];
        parent::__construct($options);
        /****************************************/
        // PARAMETERS
        /****************************************/
        // select box category (Parameter #1)
        $blockBanners = new Zend_Form_Element_Select('Param1');
        $blockBanners->setLabel(Cible_Translation::getCibleText('banners_image_group_block_page'))->setAttrib('class', 'largeSelect');
        $langId = $this->getView()->_defaultEditLanguage;
        $oGroup = new GroupObject();
        $groups = $oGroup->getAll($langId);
        foreach ($groups as $group) {
            $blockBanners->addMultiOption($group['BG_ID'], $group['BG_Name']);
        }
        $oBanner = new BannerFeaturedObject();
        $banners = $oBanner->getAll($langId);
        foreach ($banners as $banner) {
            $id = $banner['BF_ID'] . '_f';
            $blockBanners->addMultiOption($id, $banner['BF_Name']);
        }
        // Status
        $autoPlay = new Zend_Form_Element_Checkbox('Param2');
        $autoPlay->setLabel(Cible_Translation::getCibleText('banners_autoPlay_block_page'));
        $autoPlay->setDecorators(array('ViewHelper', array('label', array('placement' => 'append', 'class' => 'label_checkbox_banniere check_auto_box')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_banniere'))));
        // select box category (Parameter #3)
        $blockDelais = new Zend_Form_Element_Text('Param3');
        $blockDelais->setLabel(Cible_Translation::getCibleText('banners_delais_block_page'))->setAttrib('class', 'largeSelect')->setValue(3);
        // select box category (Parameter #4)
        $blockTransition = new Zend_Form_Element_Text('Param4');
        $blockTransition->setLabel(Cible_Translation::getCibleText('banners_transition_block_page'))->setAttrib('class', 'largeSelect')->setValue('1000');
        // Status
        $navi = new Zend_Form_Element_Checkbox('Param5');
        $navi->setLabel(Cible_Translation::getCibleText('banners_navigation_block_page'));
        $navi->setDecorators(array('ViewHelper', array('label', array('placement' => 'append', 'class' => 'label_checkbox_banniere')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_banniere'))));
        $blockEffect = new Zend_Form_Element_Select('Param6');
        $blockEffect->setLabel(Cible_Translation::getCibleText('banners_effect_block_page'))->setAttrib('class', 'largeSelect');
        $effects = array('none' => 'Aucun', 'fade' => 'fading', 'scrollHorz' => 'slide');
        $blockEffect->addMultiOptions($effects);
        $this->addElement($blockBanners);
        $this->addElement($blockDelais);
        $this->addElement($blockTransition);
        $this->addElement($navi);
        $this->addElement($autoPlay);
        $this->addElement($blockEffect);
        $this->addDisplayGroup(array('Param1', 'Param2', 'Param3', 'Param4', 'Param5', 'Param6', 'Param999'), 'parameters');
        $parameters = $this->getDisplayGroup('parameters');
        $script = <<<EOS
        \$('#Param999').change(function(){
       // console.log('passe');
            if (\$(this).val() == 'index')
            {
                \$('#Param2').show();
                \$('label[for=Param2]').show();
                \$('#Param3').show();
                \$('label[for=Param3]').show();
                \$('#Param4').show();
                \$('label[for=Param4]').show();
                \$('#Param5').show();
                \$('label[for=Param5]').show();
                \$('#Param6').show();
                \$('label[for=Param6]').show();
            }
            else
            {
                \$('#Param2').hide();
                \$('label[for=Param2]').hide();
                \$('#Param3').hide();
                \$('label[for=Param3]').hide();
                \$('#Param4').hide();
                \$('label[for=Param4]').hide();
                \$('#Param5').hide();
                \$('label[for=Param5]').hide();
                \$('#Param6').hide();
                \$('label[for=Param6]').hide();
            }
        }).change();
EOS;
        $this->getView()->inlineScript()->appendScript($script);
        //var_dump($this->getView()->inlineScript());
    }