示例#1
0
 /**
  * Return a given category lineage
  *
  * @param array $values : parameters values array(parameterName => parameterValue) in :
  *     category : the category id
  * @param multidimentionnal array $tags : xml2Array content of atm-function tag
  *     ... {id} ... {label} ...
  * @return string : the category
  * @access public
  */
 function category($values, $tags)
 {
     global $cms_language;
     $return = "";
     if (!sensitiveIO::isPositiveInteger($values['category'])) {
         $this->raiseError("Category value parameter must be a valid category ID : " . $values['category']);
         return false;
     }
     if (!isset($tags[0]['textnode'])) {
         $this->raiseError("atm-function tag must have a content");
         return false;
     }
     $params = $this->getParamsValues();
     $category = new CMS_moduleCategory($values['category']);
     if ($category->hasError()) {
         $this->raiseError("Category " . $values['category'] . " has an error ...");
         return false;
     }
     $replace = array('{id}' => $values['category'], '{label}' => $category->getLabel($cms_language), '{description}' => $category->getDescription($cms_language));
     $xml2Array = new CMS_XML2Array();
     $xml = $xml2Array->toXML($tags);
     $return .= str_replace(array_keys($replace), $replace, $xml);
     return $return;
 }
示例#2
0
    $items[] = array('xtype' => 'atmCombo', 'fieldLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_PARENT_CATEGORY), 'name' => 'parentId', 'hiddenName' => 'parentId', 'forceSelection' => true, 'mode' => 'local', 'valueField' => 'id', 'displayField' => 'name', 'triggerAction' => 'all', 'allowBlank' => true, 'selectOnFocus' => true, 'editable' => false, 'value' => isset($parentCategory) ? $parentCategory->getId() : '', 'store' => array('xtype' => 'arraystore', 'fields' => array('id', 'name'), 'data' => $selectContent));
}
// Build label list of all languages avalaibles
$count = 0;
foreach ($all_languages as $aLanguage) {
    if ($item->getFilePath($aLanguage, false, PATH_RELATIVETO_WEBROOT, true) && file_exists($item->getFilePath($aLanguage, true, PATH_RELATIVETO_FILESYSTEM))) {
        $file = new CMS_file($item->getFilePath($aLanguage, true, PATH_RELATIVETO_FILESYSTEM));
        $fileDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
    } else {
        $fileDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
    }
    $fileDatas['module'] = $codename;
    $fileDatas['visualisation'] = RESOURCE_DATA_LOCATION_PUBLIC;
    $maxFileSize = CMS_file::getMaxUploadFileSize('K');
    $mandatory = $aLanguage->getCode() == $cms_module->getDefaultLanguageCodename() ? '<span class="atm-red">*</span> ' : '';
    $items[] = array('title' => $aLanguage->getLabel(), 'xtype' => 'fieldset', 'autoHeight' => true, 'defaultType' => 'textfield', 'defaults' => array('anchor' => '100%', 'allowBlank' => true), 'items' => array(array('fieldLabel' => $mandatory . $cms_language->getMessage(MESSAGE_PAGE_FIELD_LABEL), 'xtype' => 'textfield', 'allowBlank' => !$mandatory, 'name' => 'label_' . $aLanguage->getCode(), 'value' => $item->getLabel($aLanguage, false)), array('fieldLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_DESC), 'xtype' => 'ckeditor', 'name' => 'description_' . $aLanguage->getCode(), 'value' => (string) $item->getDescription($aLanguage, false, false), 'height' => 200, 'editor' => array('scayt_sLang' => $aLanguage->getCode(), 'language' => $cms_language->getCode(), 'customConfig' => PATH_MAIN_WR . '/ckeditor/config.php', 'atmToolbar' => 'BasicLink')), array('fieldLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_FILE), 'xtype' => 'atmFileUploadField', 'name' => 'file_' . $aLanguage->getCode(), 'uploadCfg' => array('file_size_limit' => $maxFileSize, 'file_types_description' => $cms_language->getJSMessage(MESSAGE_ALL_FILE) . ' ...', 'file_types' => '*.*'), 'fileinfos' => $fileDatas)));
    //Thumbnail and protected after first language
    if (!$count) {
        if ($item->getIconPath(false, PATH_RELATIVETO_WEBROOT, true) && file_exists($item->getIconPath(true, PATH_RELATIVETO_FILESYSTEM, true))) {
            $file = new CMS_file($item->getIconPath(true, PATH_RELATIVETO_FILESYSTEM, true));
            $imageDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
        } else {
            $imageDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
        }
        $imageDatas['module'] = $codename;
        $imageDatas['visualisation'] = RESOURCE_DATA_LOCATION_PUBLIC;
        $items[] = array('xtype' => 'atmImageUploadField', 'fieldLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_THUMBNAIL), 'name' => 'icon', 'uploadCfg' => array('file_size_limit' => $maxFileSize, 'file_types' => '*.jpg;*.png;*.gif', 'file_types_description' => $cms_language->getMessage(MESSAGE_IMAGE) . ' ...'), 'fileinfos' => $imageDatas);
        //Protected status
        $protectedItem = array('fieldLabel' => '<span ext:qtip="' . io::htmlspecialchars($cms_language->getMessage(MESSAGE_PAGE_FIELD_PROTECTED_INFO)) . '" class="atm-help">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_PROTECTED) . '</span>', 'name' => 'protected', 'inputValue' => '1', 'xtype' => 'checkbox', 'checked' => $item->isProtected() ? true : false, 'boxLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_PROTECTED_DESC));
        //add an alert on protected option for non admin users
        if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {