Пример #1
1
 public function init()
 {
     $photo = cmsCore::getController('photos');
     return array(array('type' => 'fieldset', 'title' => LANG_OPTIONS, 'childs' => array(new fieldCheckbox('options:auto_user', array('title' => LANG_PHOTOS_O_AUTO_USER, 'hint' => LANG_PHOTOS_O_AUTO_USER_HINT, 'default' => 1)), new fieldCheckbox('options:auto_group', array('title' => LANG_PHOTOS_O_AUTO_GROUP, 'hint' => LANG_PHOTOS_O_AUTO_GROUP_HINT, 'default' => 1)), new fieldCheckbox('options:auto_ctype_item', array('title' => LANG_PHOTOS_O_AUTO_CTYPE_ITEM, 'hint' => LANG_PHOTOS_O_AUTO_CTYPE_ITEM_HINT, 'default' => 1)), new fieldList('options:target', array('title' => LANG_PHOTOS_O_TARGET, 'items' => array(LANG_ALL, LANG_PHOTOS_PUBLIC_ALBUMS, LANG_PHOTOS_USER_ALBUMS), 'default' => 0)), new fieldList('options:album_id', array('title' => LANG_PHOTOS_ALBUM, 'generator' => function () {
         $_items = cmsCore::getModel('content')->limit(false)->disablePrivacyFilter()->getContentItemsForSitemap('albums', array('id', 'title'));
         $items = array('' => '');
         if ($_items) {
             foreach ($_items as $item) {
                 $items[$item['id']] = $item['title'];
             }
         }
         return $items;
     }, 'default' => '')), new fieldList('options:ordering', array('title' => LANG_SORTING, 'items' => array('' => '') + modelPhotos::getOrderList(), 'default' => '')), new fieldList('options:orientation', array('title' => LANG_PHOTOS_O_ORIENTATION, 'items' => modelPhotos::getOrientationList(), 'default' => '')), new fieldList('options:type', array('title' => LANG_PHOTOS_O_TYPE, 'items' => !empty($photo->options['types']) ? array('' => LANG_PHOTOS_ALL) + $photo->options['types'] : array(), 'default' => '')), new fieldNumber('options:width', array('title' => LANG_PHOTOS_SIZE_W . ', ' . mb_strtolower(LANG_PHOTOS_MORE_THAN), 'units' => 'px', 'default' => '')), new fieldNumber('options:height', array('title' => LANG_PHOTOS_SIZE_H . ', ' . mb_strtolower(LANG_PHOTOS_MORE_THAN), 'units' => 'px', 'default' => '')), new fieldNumber('options:limit', array('title' => LANG_LIST_LIMIT, 'default' => 10, 'rules' => array(array('required')))))));
 }
Пример #2
0
 public function run($data)
 {
     list($ctype, $album, $fields) = $data;
     $is_allow = $album['is_public'] || $album['user_id'] == $this->cms_user->id || $this->cms_user->is_admin;
     if ($is_allow && cmsUser::isAllowed($ctype['name'], 'add')) {
         $this->cms_template->addToolButton(array('class' => 'images', 'title' => LANG_PHOTOS_UPLOAD, 'href' => href_to($this->name, 'upload', $album['id'])));
     }
     $album['filter_panel'] = array('ordering' => modelPhotos::getOrderList(), 'types' => !empty($this->options['types']) ? array('' => LANG_PHOTOS_ALL) + $this->options['types'] : array(), 'orientation' => modelPhotos::getOrientationList(), 'width' => '', 'height' => '');
     $album['filter_values'] = array('ordering' => $this->cms_core->request->get('ordering', $this->options['ordering']), 'types' => $this->cms_core->request->get('types', ''), 'orientation' => $this->cms_core->request->get('orientation', ''), 'width' => $this->cms_core->request->get('width', 0) ?: '', 'height' => $this->cms_core->request->get('height', 0) ?: '');
     $album['url_params'] = array_filter($album['filter_values']);
     $album['filter_selected'] = $album['url_params'];
     if ($album['filter_selected']['ordering'] == $this->options['ordering']) {
         unset($album['filter_selected']['ordering']);
     }
     if (!in_array($album['filter_values']['ordering'], array_keys($album['filter_panel']['ordering']))) {
         $album['filter_values']['ordering'] = 'date_pub';
     }
     if ($album['filter_values']['types'] && !in_array($album['filter_values']['types'], array_keys($album['filter_panel']['types']))) {
         $album['filter_values']['types'] = '';
     }
     if ($album['filter_values']['orientation'] && !in_array($album['filter_values']['orientation'], array_keys($album['filter_panel']['orientation']))) {
         $album['filter_values']['orientation'] = '';
     }
     $album['base_url'] = href_to($ctype['name'], $album['slug'] . '.html') . '?' . http_build_query($album['url_params']);
     foreach ($album['filter_selected'] as $key => $value) {
         if (isset($album['filter_panel'][$key][$value])) {
             $title[] = $album['filter_panel'][$key][$value];
         }
     }
     if (!empty($title)) {
         $album['title'] .= ' — ' . mb_strtolower(implode(', ', $title));
         $album['seo_desc'] .= ' ' . $album['title'];
     }
     return array($ctype, $album, $fields);
 }
Пример #3
0
 public function init()
 {
     $presets = cmsCore::getModel('images')->getPresetsList();
     foreach ($presets as $name => $title) {
         $perm_childs[] = new fieldListGroups('download_view:' . $name, array('title' => sprintf(LANG_PHOTOS_DOWNLOAD_VIEW, $title), 'show_all' => true, 'show_guests' => true));
         $perm_childs[] = new fieldListGroups('download_hide:' . $name, array('title' => sprintf(LANG_PHOTOS_DOWNLOAD_HIDE, $title), 'show_guests' => true));
     }
     $perm_childs[] = new fieldListGroups('download_view:original', array('title' => sprintf(LANG_PHOTOS_DOWNLOAD_VIEW, LANG_PARSER_IMAGE_SIZE_ORIGINAL), 'show_all' => true, 'show_guests' => true));
     $perm_childs[] = new fieldListGroups('download_hide:original', array('title' => sprintf(LANG_PHOTOS_DOWNLOAD_HIDE, LANG_PARSER_IMAGE_SIZE_ORIGINAL), 'show_guests' => true));
     return array(array('title' => LANG_OPTIONS, 'type' => 'fieldset', 'childs' => array(new fieldListMultiple('sizes', array('title' => LANG_PHOTOS_SIZES, 'default' => array('big', 'normal', 'small'), 'items' => $presets, 'rules' => array(array('required')))), new fieldCheckbox('is_origs', array('title' => LANG_PHOTOS_SAVE_ORIG, 'hint' => LANG_PHOTOS_SAVE_ORIG_HINT, 'default' => 1)), new fieldList('preset', array('title' => LANG_PHOTOS_PRESET, 'default' => 'big', 'items' => $presets, 'rules' => array(array('required')))), new fieldList('preset_small', array('title' => LANG_PHOTOS_PRESET_SMALL, 'default' => 'normal', 'items' => $presets, 'rules' => array(array('required')))), new fieldList('preset_related', array('title' => LANG_PHOTOS_PRESET_RELATED, 'default' => 'normal', 'items' => $presets, 'rules' => array(array('required')))), new fieldText('types', array('title' => LANG_PHOTOS_TYPES, 'hint' => LANG_PHOTOS_TYPES_HINT, 'default' => "1 | Фото\n2 | Векторы\n3 | Иллюстрации", 'size' => 8)), new fieldList('ordering', array('title' => LANG_SORTING, 'default' => 'date_pub', 'items' => modelPhotos::getOrderList())), new fieldNumber('limit', array('title' => LANG_LIST_LIMIT, 'default' => 16, 'rules' => array(array('required')))), new fieldNumber('related_limit', array('title' => LANG_PHOTOS_RELATED_LIMIT, 'default' => 20, 'rules' => array(array('required')))), new fieldString('url_pattern', array('title' => LANG_PHOTOS_URL_PATTERN, 'prefix' => '/photos/', 'suffix' => '.html', 'default' => '{id}-{title}', 'rules' => array(array('required')))))), array('title' => LANG_PERMISSIONS, 'type' => 'fieldset', 'childs' => $perm_childs));
 }