Joostina CMS / CMF v2.* API
  • Docs
  • Package
  • Class
  • Tree
  • Todo
Overview

Packages

  • Components
    • Acls
      • Models
        • Admin
        • Site
    • BlogCategory
      • Models
        • Admin
        • Site
    • Blogs
      • Controllers
        • Admin
        • Site
      • Helpers
      • Models
        • Admin
        • Site
    • Coder
      • Controllers
        • Admin
      • Models
        • Admin
    • Comments
      • Controllers
        • Admin
        • Site
      • Helpers
      • Models
        • Admin
        • Site
    • CommentsCounter
      • Models
        • Admin
        • Site
    • Mainpage
      • Controllers
        • Site
    • News
      • Controllers
        • Admin
        • Site
      • Helpers
      • Models
        • Admin
        • Site
    • Pages
      • Controllers
        • Admin
        • Site
      • Models
        • Site
    • Search
      • Controllers
        • Site
    • Site
      • Controllers
        • Admin
        • Site
    • Sitemap
      • Controllers
        • Admin
        • Site
      • Models
        • Admin
        • Site
    • Test
      • Controllers
        • Site
    • Torrents
      • Controllers
        • Site
    • Users
      • Controllers
        • Admin
        • Site
      • Models
        • Admin
        • Site
  • Compression
  • Core
    • Libraries
      • Arhive
      • Array
      • Attached
      • Autoadmin
      • Autoloader
      • Benchmark
      • Breadcrumbs
      • Cache
      • Config
      • Cookie
      • Csrf
      • Database
        • Drivers
          • Interfaces
      • Datetime
      • Debug
      • Editor
      • Events
      • File
      • Filter
      • Flashmessage
      • Folder
      • Hit
      • Html
      • Image
      • Inflector
      • Inputfilter
      • Libraries
      • Mail
      • Module
      • Nestedset
      • Pager
      • Pages
      • Params
      • Randomizer
      • Request
      • RobotLoader
      • Route
      • Security
      • Session
      • Static
      • String
      • Text
      • Trash
      • Validate
  • Email
  • Extra
    • Libraries
      • Basket
  • Joostina
    • Controller
    • Core
    • Document
  • JSMin
  • Libraries
    • Extra
      • Basket
        • Models
          • Site
  • None
  • Plugins
    • Autoadmin
    • Editor
    • Sitemap
  • SimpleMail
  • Vendors
    • Libraries
      • Email

Classes

  • helperAcl
  • joosAdminToolbarButtons
  • joosAdminView
  • joosAdminViewToolbarEdit
  • joosAdminViewToolbarListing
  • joosAutoadminHTML
  • joosTemplater
  • joosValidateHelper
  • modelAdminCoder_Faker
  • moduleActions
  • moduleActionsLogin
  • moduleActionsMenu
  • moduleActionsNews
  • moduleActionsTest
  • Route
  • rulesValidation
  • TreeBuilder

Interfaces

  • joosAutoadminPluginsEdit
  • joosAutoadminPluginsTable

Exceptions

  • joosAutoadminClassPlugionNotFoundException
  • joosAutoadminFilePluginNotFoundException
  • joosAutoloaderClassNotFoundException
  • joosAutoloaderFileNotFoundException
  • joosAutoloaderOnStartFileNotFoundException
  • joosCacheException
  • joosCoreException
  • joosDatabaseException
  • joosException
  • joosFileLibrariesException
  • joosFolderLibrariesException
  • joosImageLibrariesException
  • joosModulesException
  • joosSimpleMailException
  • joosUploadLibrariesException
  • joosUserException
  • JSMinException

Functions

  • navigation_ul_li_recurse
  • quoted_printable_encode
  1: <?php defined('_JOOS_CORE') or exit();
  2: 
  3: /**
  4:  * @package   Joostina
  5:  * @copyright Авторские права (C) 2007-2010 Joostina team. Все права защищены.
  6:  * @license   Лицензия http://www.gnu.org/licenses/gpl-2.0.htm GNU/GPL, или help/license.php
  7:  * Joostina! - свободное программное обеспечение распространяемое по условиям лицензии GNU/GPL
  8:  * Для получения информации о используемых расширениях и замечаний об авторском праве, смотрите файл help/copyright.php.
  9:  */
 10: 
 11: class joosModuleAdmin
 12: {
 13:     public static function load_by_name($module_name)
 14:     {
 15:         $module_file = JPATH_BASE_APP . DS . 'modules' . DS . $module_name . DS . $module_name . '.php';
 16: 
 17:         if (joosFile::exists($module_file)) {
 18:             require_once $module_file;
 19:         } else {
 20:             throw new joosException('Файл :file_name для модуля :module_name не найден', array(':module_name' => $module_name, ':file_name' => $module_file));
 21:         }
 22:     }
 23: 
 24:     public static function view($module_name, $template_view = 'default')
 25:     {
 26:         return JPATH_BASE_APP . DS . 'modules' . DS . $module_name . DS . 'views' . DS . $template_view . '.php';
 27:     }
 28: 
 29:     public static function render($module_name, array $params = array())
 30:     {
 31:         $template_view = isset($params['template']) ? $params['template'] : 'default';
 32: 
 33:         extract($params, EXTR_OVERWRITE);
 34: 
 35:         require_once self::view($module_name, $template_view);
 36:     }
 37: 
 38: }
 39: 
 40: /**
 41:  * Расширение ядра для работы панели управления
 42:  *
 43:  * @package    Joostina
 44:  * @subpackage Core
 45:  */
 46: class joosCoreAdmin extends joosCore
 47: {
 48:     /**
 49:      * Скрытая инстанция текущего авторизованного пользователя
 50:      *
 51:      * @var User
 52:      */
 53:     private static $user = false;
 54: 
 55:     public static function start()
 56:     {
 57:         // стартуем сессию с названием из конфигурации
 58:         session_name(JADMIN_SESSION_NAME);
 59:         session_start();
 60: 
 61:         joosCore::set_admin_mode();
 62: 
 63:         // это что бы в админке запоминались фильтры, последние страницы и прочие вкусняшки
 64:         joosSession::init_user_state();
 65:     }
 66: 
 67:     public static function user()
 68:     {
 69:         return self::$user;
 70:     }
 71: 
 72:     public static function init_user()
 73:     {
 74:         $option = joosRequest::param('option');
 75: 
 76:         // logout check
 77:         if ($option == 'logout') {
 78:             $database = joosDatabase::instance();
 79: 
 80:             // обновление записи последнего посещения панели управления в базе данных
 81:             if (isset($_SESSION['session_user_id']) && $_SESSION['session_user_id'] != '') {
 82:                 $query = "UPDATE #__users SET lastvisit_date = " . $database->get_quoted(JCURRENT_SERVER_TIME) . " WHERE id = " . (int) $_SESSION['session_user_id'];
 83:                 $database->set_query($query)->query();
 84:             }
 85: 
 86:             // delete db session record corresponding to currently logged in user
 87:             if (isset($_SESSION['session_id']) && $_SESSION['session_id'] != '') {
 88:                 $query = "DELETE FROM #__users_session WHERE session_id = " . $database->get_quoted($_SESSION['session_id']);
 89:                 $database->set_query($query)->query();
 90:             }
 91: 
 92:             session_destroy();
 93:             joosRoute::redirect('index.php');
 94:         }
 95: 
 96:         if (session_name() != JADMIN_SESSION_NAME) {
 97:             joosRoute::redirect(JPATH_SITE_ADMIN, 'Ошибка сессии');
 98:         }
 99: 
100:         $my = new modelUsers();
101:         $my->id = joosRequest::int('session_user_id', 0, $_SESSION);
102:         $my->user_name = joosRequest::session('session_user_name');
103: 
104:         $session_id = joosRequest::session('session_id');
105:         $logintime = joosRequest::session('session_logintime');
106: 
107:         if ($session_id != session_id()) {
108:             joosRoute::redirect(JPATH_SITE_ADMIN, 'Вы не авторизованы');
109:         }
110: 
111:         // check to see if session id corresponds with correct format
112:         if ($session_id == md5($my->id . $my->user_name . $logintime)) {
113: 
114:             $task = joosRequest::param('task');
115:             if ($task != 'save' && $task != 'apply') {
116: 
117:                 $database = joosDatabase::instance();
118: 
119:                 $session_life_admin = joosConfig::get2('session', 'life_admin');
120: 
121:                 // purge expired admin sessions only
122:                 $past = time() - $session_life_admin;
123:                 $query = "DELETE FROM #__users_session WHERE time < '" . (int) $past . "' AND guest = 1 AND user_id <> 0";
124:                 $database->set_query($query)->query();
125: 
126:                 // update session timestamp
127:                 $query = "UPDATE #__users_session SET time = " . $database->get_quoted(time()) . " WHERE session_id = " . $database->get_quoted($session_id);
128:                 $database->set_query($query)->query();
129: 
130:                 // set garbage cleaning timeout
131:                 self::set_session_garbage_clean($session_life_admin);
132: 
133:                 // check against db record of session
134:                 $query = "SELECT COUNT( session_id ) FROM #__users_session WHERE session_id = " . $database->get_quoted($session_id) . " AND user_name = " . $database->get_quoted($my->user_name) . " AND user_id = " . (int) $my->id;
135:                 $count = $database->set_query($query)->load_result();
136: 
137:                 // если в таблице нет информации о текущей сессии - она устарела
138:                 if ($count == 0) {
139:                     setcookie(JADMIN_SESSION_NAME);
140:                     // TODO тут можно сделать нормальную запоминалку последней активной страницы, и разных данных с неё. И записывать всё это как параметры пользователя в JSON
141:                     joosRoute::redirect(JPATH_SITE_ADMIN, 'Вы не авторизованы');
142:                 }
143:             }
144:         } elseif ($session_id == '') {
145:             joosRoute::redirect(JPATH_SITE, 'Вы не авторизованы');
146:         } else {
147:             joosRoute::redirect(JPATH_SITE, 'Вы не авторизованы');
148:             exit();
149:         }
150: 
151:         self::$user = $my;
152:     }
153: 
154:     public static function set_session_garbage_clean($session_life_admin)
155:     {
156:         if (!defined('_JOS_GARBAGECLEAN')) {
157:             define('_JOS_GARBAGECLEAN', 1);
158: 
159:             $garbage_timeout = $session_life_admin + 600;
160:             ini_set('session.gc_maxlifetime', $garbage_timeout);
161:         }
162:     }
163: 
164: }
165: 
166: /**
167:  * Постраничная навигация для панели управления
168:  * @category core
169:  * @category admin_cp
170:  * @package  Joostina
171:  */
172: class joosAdminPagenator
173: {
174:     public $limitstart;
175:     public $limit;
176:     public $total;
177: 
178:     public function joosAdminPagenator($total, $limitstart, $limit)
179:     {
180:         $this->total = (int) $total;
181:         $this->limitstart = (int) max($limitstart, 0);
182:         $this->limit = (int) max($limit, 1);
183:         if ($this->limit > $this->total) {
184:             $this->limitstart = 0;
185:         }
186:         if (($this->limit - 1) * $this->limitstart > $this->total) {
187:             $this->limitstart -= $this->limitstart % $this->limit;
188:         }
189:     }
190: 
191:     public function get_limit_box()
192:     {
193:         // если элементов нет - то и селектор-ограничитель показывать незачем
194:         if ($this->total == 0) {
195:             return '';
196:         }
197: 
198:         $limits = array();
199:         for ($i = 5; $i <= 30; $i += 5) {
200:             $limits[] = joosHtml::make_option("$i");
201:         }
202: 
203:         $limits[] = joosHtml::make_option('50');
204:         $limits[] = joosHtml::make_option('100');
205:         $limits[] = joosHtml::make_option('150');
206:         $limits[] = joosHtml::make_option('50000', '-Всё-');
207:         // build the html select list
208:         $html = ' ' . 'Отображать' . ' ';
209:         $html .= joosHtml::select_list($limits, 'limit', 'class="js-limit" size="1"', 'value', 'text', $this->limit);
210:         $html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
211: 
212:         return $html;
213:     }
214: 
215:     public function write_limit_box()
216:     {
217:         echo joosAdminPagenator::get_limit_box();
218:     }
219: 
220:     public function write_pages_counter()
221:     {
222:         echo $this->get_pages_counter();
223:     }
224: 
225:     public function get_pages_counter()
226:     {
227:         $html = '';
228:         $from_result = $this->limitstart + 1;
229:         if ($this->limitstart + $this->limit < $this->total) {
230:             $to_result = $this->limitstart + $this->limit;
231:         } else {
232:             $to_result = $this->total;
233:         }
234:         if ($this->total > 0) {
235:             $html .= "\n" . $from_result . "-" . $to_result . " " . 'из' . " " . $this->total;
236:         } else {
237:             $html .= "\n" . 'Записи не найдены';
238:         }
239: 
240:         return '' . $html;
241:     }
242: 
243:     public function write_pages_links()
244:     {
245:         echo $this->get_pages_links();
246:     }
247: 
248:     public function get_pages_links()
249:     {
250:         $total_pages = ceil($this->total / $this->limit);
251: 
252:         // скрываем навигатор по страницам если их меньше 2х.
253:         if ($total_pages < 2) {
254:             return '';
255:         }
256: 
257:         $html = '<ul>';
258:         $displayed_pages = 10;
259: 
260:         $this_page = ceil(($this->limitstart + 1) / $this->limit);
261:         $start_loop = (floor(($this_page - 1) / $displayed_pages)) * $displayed_pages + 1;
262:         if ($start_loop + $displayed_pages - 1 < $total_pages) {
263:             $stop_loop = $start_loop + $displayed_pages - 1;
264:         } else {
265:             $stop_loop = $total_pages;
266:         }
267: 
268:         if ($this_page > 1) {
269:             $page = ($this_page - 2) * $this->limit;
270: 
271:             $html .= "<li><a href=\"#prev\" class=\"js-pagenav\" data-page=\"$page\">&larr;</a></li>";
272:         } else {
273: 
274:             $html .= "<li class=\"disabled\"><a href=\"#\"  class=\"pagenav\">&larr;</a></li>";
275:         }
276: 
277:         for ($i = $start_loop; $i <= $stop_loop; $i++) {
278:             $page = ($i - 1) * $this->limit;
279:             if ($i == $this_page) {
280:                 $html .= "<li class=\"active\"><a href=\"#\" class=\"pagenav\"> $i </a></li>";
281:             } else {
282:                 $html .= "<li><a href=\"#$i\" class=\"js-pagenav\"  data-page=\"$page\">$i</a></li>";
283:             }
284:         }
285: 
286:         if ($this_page < $total_pages) {
287:             $page = $this_page * $this->limit;
288:             $html .= "<li><a href=\"#next\"  class=\"js-pagenav\"  data-page=\"$page\">&rarr;</a></li>";
289:         } else {
290:             $html .= "<li class=\"disabled\"><a href=\"#\" class=\"pagenav\">&rarr;</a></li>";
291:         }
292: 
293:         return $html . '</ul>';
294:     }
295: 
296:     public function get_list_footer()
297:     {
298:         $html = '<div class="adminpaginator">';
299:         $html .= '<div class="adminpaginator_pages_counter"><span class="ap-pagescount">' . $this->get_pages_counter() . '</span>' . $this->get_limit_box() . '</div><div class="ap-pages">' . $this->get_pages_links() . '</div>';
300:         $html .= '</div>';
301: 
302:         return $html;
303:     }
304: 
305:     public function row_number($i)
306:     {
307:         return $i + 1 + $this->limitstart;
308:     }
309: 
310:     public function order_up_icon($i, $condition = true, $task = 'orderup', $alt = _PN_MOVE_TOP)
311:     {
312:         if (($i > 0 || ($i + $this->limitstart > 0)) && $condition) {
313:             return '<a href="#reorder" onClick="return listItemTask(\'cb' . $i . '\',\'' . $task . '\')" title="' . $alt . '"><img src="' . joosConfig::get('admin_icons_path') . 'uparrow.png" width="12" height="12" border="0" alt="' . $alt . '" /></a>';
314:         } else {
315:             return '&nbsp;';
316:         }
317:     }
318: 
319:     public function order_down_icon($i, $n, $condition = true, $task = 'orderdown', $alt = _PN_MOVE_DOWN)
320:     {
321:         if (($i < $n - 1 || $i + $this->limitstart < $this->total - 1) && $condition) {
322:             return '<a href="#reorder" onClick="return listItemTask(\'cb' . $i . '\',\'' . $task . '\')" title="' . $alt . '"><img src="' . joosConfig::get('admin_icons_path') . 'downarrow.png" width="12" height="12" border="0" alt="' . $alt . '" /></a>';
323:         } else {
324:             return '&nbsp;';
325:         }
326:     }
327: 
328:     public function order_up_icon2($id, $order)
329:     {
330:         if ($order == 0) {
331:             $img = 'uparrow.png';
332:             $show = true;
333:         } elseif ($order < 0) {
334:             $img = 'uparrow.png';
335:             $show = true;
336:         } else {
337:             $img = 'uparrow.png';
338:             $show = true;
339:         }
340: 
341:         if ($show) {
342:             $output = '<a href="#ordering" onClick="listItemTask(\'cb' . $id . '\',\'orderup\')" title="' . _NAV_ORDER_UP . '">';
343:             $output .= '<img src="' . joosConfig::get('admin_icons_path') . $img . '" width="12" height="12" border="0" alt="' . _NAV_ORDER_UP . '" title="' . _NAV_ORDER_UP . '" /></a>';
344: 
345:             return $output;
346:         } else {
347:             return '&nbsp;';
348:         }
349:     }
350: 
351:     public function order_down_icon2($id, $order)
352:     {
353:         if ($order == 0) {
354:             $img = 'downarrow.png';
355:             $show = true;
356:         } elseif ($order < 0) {
357:             $img = 'downarrow.png';
358:             $show = true;
359:         } else {
360:             $img = 'downarrow.png';
361:             $show = true;
362:         }
363: 
364:         if ($show) {
365:             $output = '<a href="#ordering" onClick="listItemTask(\'cb' . $id . '\',\'orderdown\')" title="' . _NAV_ORDER_DOWN . '">';
366:             $output .= '<img src="' . joosConfig::get('admin_icons_path') . $img . '" width="12" height="12" border="0" alt="' . _NAV_ORDER_DOWN . '" title="' . _NAV_ORDER_DOWN . '" /></a>';
367: 
368:             return $output;
369:         } else {
370:             return '&nbsp;';
371:         }
372:     }
373: 
374: }
375: 
376: /**
377:  * Базовый контроллер работы панели управления Joostina CMS
378:  * @package    Joostina
379:  * @subpackage Controller
380:  *
381:  * //  extends joosController
382:  *
383:  */
384: class joosAdminController
385: {
386:     /**
387:      * Пункты подменю компеонента
388:      *
389:      * @var array
390:      */
391:     protected static $submenu = array();
392: 
393:     /**
394:      * Текущий активный пункт меню
395:      *
396:      * @var string
397:      */
398:     protected static $active_menu = 'default';
399: 
400:     public static function get_submenu()
401:     {
402:         return static::$submenu;
403:     }
404: 
405:     public static function action_before()
406:     {
407:         $menu = joosRequest::request('menu', false);
408: 
409:         if ($menu && isset(static::$submenu[$menu])) {
410: 
411:             static::$active_menu = $menu;
412:         } else {
413: 
414:             $menu = static::$active_menu;
415:         }
416: 
417:         static::$submenu[$menu]['active'] = true;
418: 
419:         if (isset(static::$submenu[$menu]['model'])) {
420:             joosAutoadmin::set_active_model_name(static::$submenu[$menu]['model']);
421:         }
422: 
423:         joosAutoadmin::set_active_menu_name($menu);
424:     }
425: 
426:     public static function index()
427:     {
428:         $obj = joosAutoadmin::get_active_model_obj();
429: 
430:         $obj_count = joosAutoadmin::get_count($obj);
431: 
432:         $pagenav = joosAutoadmin::pagenav($obj_count);
433: 
434:         $param = array('offset' => $pagenav->limitstart, 'limit' => $pagenav->limit, 'order' => 'id DESC');
435:         $obj_list = joosAutoadmin::get_list($obj, $param);
436: 
437:         $fields_list = isset(static::$submenu[static::$active_menu]['fields']) ? static::$submenu[static::$active_menu]['fields'] : array('id', 'title', 'state');
438: 
439:         // передаём информацию о объекте и настройки полей в формирование представления
440:         joosAutoadmin::listing($obj, $obj_list, $pagenav, $fields_list);
441:     }
442: 
443:     public static function create()
444:     {
445:         static::edit();
446:     }
447: 
448:     public static function edit()
449:     {
450:         $id = joosRequest::get('id', 0);
451: 
452:         $obj_data = joosAutoadmin::get_active_model_obj();
453:         $id > 0 ? $obj_data->load($id) : null;
454: 
455:         joosAutoadmin::edit($obj_data, $obj_data);
456:     }
457: 
458:     public static function save($redirect = 0)
459:     {
460:         joosCSRF::check_code();
461: 
462:         $obj_data = joosAutoadmin::get_active_model_obj();
463:         $save_result = $obj_data->save($_POST);
464: 
465:         $option = joosRequest::param('option');
466: 
467:         if ($save_result !== true) {
468:             $errors = $obj_data->get_errors();
469:             joosFlashMessage::add($errors, 'success');
470:             joosAutoadmin::edit($obj_data, $obj_data);
471: 
472:             return;
473:         }
474: 
475:         switch ($redirect) {
476:             default:
477:             case 0: // просто сохранение
478:                 joosRoute::redirect('index2.php?option=' . $option . '&menu=' . static::$active_menu, 'Всё ок!');
479:                 break;
480: 
481:             case 1: // применить
482:                 joosRoute::redirect('index2.php?option=' . $option . '&menu=' . static::$active_menu . '&task=edit&id=' . $obj_data->id, 'Всё ок, редактируем дальше');
483:                 break;
484: 
485:             case 2: // сохранить и добавить новое
486:                 joosRoute::redirect('index2.php?option=' . $option . '&menu=' . static::$active_menu . '&task=create', 'Всё ок, создаём новое');
487:                 break;
488:         }
489:     }
490: 
491:     public static function apply()
492:     {
493:         return static::save(1);
494:     }
495: 
496:     public static function save_and_new()
497:     {
498:         return static::save(2);
499:     }
500: 
501:     public static function remove()
502:     {
503:         joosCSRF::check_code();
504: 
505:         // идентификаторы удаляемых объектов
506:         $cid = (array) joosRequest::array_param('cid');
507:         $option = joosRequest::param('option');
508: 
509:         $obj_data = joosAutoadmin::get_active_model_obj();
510:         $obj_data->delete_array($cid, 'id') ? joosRoute::redirect('index2.php?option=' . $option . '&menu=' . static::$active_menu, 'Удалено успешно!') : joosRoute::redirect('index2.php?option=' . $option . '&menu=' . static::$active_menu, 'Ошибка удаления');
511:     }
512: 
513:     public static function publish()
514:     {
515:         self::publish_unpublish(1);
516:     }
517: 
518:     public static function unpublish()
519:     {
520:         self::publish_unpublish(0);
521:     }
522: 
523:     /**
524:      * Смена статуса (поля 'state')
525:      */
526:     public static function publish_unpublish($state = 1)
527:     {
528:         joosCSRF::check_code();
529: 
530:         $cid = (array) joosRequest::array_param('cid');
531:         $option = joosRequest::param('option');
532: 
533:         $obj_data = joosAutoadmin::get_active_model_obj();
534:         $obj_data->set_state_group($cid, $state) ? joosRoute::redirect('index2.php?option=' . $option . '&menu=' . static::$active_menu, 'Выполнено успешно') : joosRoute::redirect('index2.php?option=' . $option . '&menu=' . static::$active_menu, 'Ошибка смены статуса');
535:     }
536: 
537: }
538: 
539: /**
540:  * Базовый ajax контроллер работы панели управления Joostina CMS
541:  * @package    Joostina
542:  * @subpackage Controller
543:  *
544:  */
545: class joosAdminControllerAjax extends joosAdminController
546: {
547:     /**
548:      * Смена статуса (поля 'state')
549:      */
550:     public static function set_state()
551:     {
552:         $obj_id = joosRequest::int('obj_id', 0, $_POST);
553:         $obj_state = joosRequest::post('obj_state');
554:         $obj_model = joosRequest::post('obj_model');
555: 
556:         if (!$obj_model || !class_exists($obj_model)) {
557:             return array('type' => 'error');
558:         }
559: 
560:         $new_state = ($obj_state == 1 ? 0 : 1);
561: 
562:         $obj = new $obj_model;
563:         $obj->load($obj_id);
564: 
565:         if (!$obj->change_state('state')) {
566:             return array('type' => 'error');
567:         }
568: 
569:         return array('type' => 'success', 'message' => 'Статус изменён', 'new_state' => $new_state, 'new_title' => $new_state == 1 ? 'Активно' : 'Не активно', 'new_class' => $new_state == 1 ? 'icon-ok' : 'icon-remove');
570: 
571:     }
572: 
573:     /**
574:      * Загрузка изображений для текстов материалов (через визуальный редактор)
575:      * Грузятся в /attachments/images_embedded
576:      */
577:     public static function upload_images_embedded()
578:     {
579:         $upload_result = joosUpload::easy_upload('file', JPATH_BASE_APP . '/attachments/images_embedded/', array('new_name' => date('YmdHis')));
580: 
581:         echo '<img src="' . $upload_result['file_live_location'] . '" />';
582:     }
583: 
584:     /**
585:      * Загрузка файлов для текстов материалов (через визуальный редактор)
586:      * Грузятся в /attachments/files_embedded
587:      */
588:     public static function upload_files_embedded()
589:     {
590:         $upload_result = joosUpload::easy_upload('file', JPATH_BASE_APP . '/attachments/files_embedded/', array('new_name' => date('YmdHis')));
591:         echo '<a href="' . $upload_result['file_live_location'] . '" class="redactor_file_link redactor_file_ico_' . $upload_result['file_info']['ext'] . '">' . $upload_result['file_name'] . '</a>';
592:     }
593: 
594:     /**
595:      * Смена статуса публикации объекта
596:      *
597:      * @static
598:      * @return bool
599:      */
600:     public static function status_change()
601:     {
602:         return joosAutoadmin::autoajax();
603:     }
604: 
605: }
606: 
607: class joosAdminView
608: {
609:     private static $component_params = array('component_title' => '', 'submenu' => array(), 'component_header' => '', 'current_model' => '');
610: 
611:     private static $listing_elements = array('table_headers' => '');
612: 
613:     public static function  set_param($name, $value)
614:     {
615:         self::$component_params[$name] = $value;
616:     }
617: 
618:     public static function  set_listing_param($name, $value)
619:     {
620:         self::$listing_elements[$name] = $value;
621:     }
622: 
623:     public static function get_component_title()
624:     {
625:         return self::$component_params['component_title'];
626:     }
627: 
628:     public static function get_component_header()
629:     {
630:         return self::$component_params['component_header'];
631:     }
632: 
633:     public static function get_submenu()
634:     {
635:         $options = joosAutoadmin::get_option();
636: 
637:         foreach (self::$component_params['submenu'] as $menu_name => &$href) {
638:             $href['href'] = isset($href['href']) ? $href['href'] : sprintf('index2.php?option=%s&menu=%s', $options, $menu_name);
639:         }
640: 
641:         return self::$component_params['submenu'];
642:     }
643: 
644:     public static function get_current_model()
645:     {
646:         return self::$component_params['current_model'];
647:     }
648: 
649:     public static function get_listing_param($name)
650:     {
651:         return self::$listing_elements[$name];
652:     }
653: 
654: }
655: 
656: class joosAdminViewToolbarListing
657: {
658: }
659: 
660: class joosAdminViewToolbarEdit
661: {
662: }
663: 
Joostina CMS / CMF v2.* API API documentation generated by ApiGen 2.6.1 – Template adapted by @olvlv and Joostina Team