Пример #1
0
 public function getSiteusers($conditions = '', $limit = null, $offset = null)
 {
     $driver = DataSource::getCurrent();
     $sql = 'SELECT
       SQL_CALC_FOUND_ROWS
       *
     FROM
       siteuser
     WHERE
       deleted = 0' . (!empty($conditions) ? " and {$conditions}" : '') . (is_null($limit) ? '' : " limit {$limit}") . (is_null($offset) ? '' : " offset {$offset}");
     $driver->query($sql);
     return $driver->fetchAssoc();
 }
Пример #2
0
    public function getGalleryItems(Gallery $oGallery, $filterConditions = [], $limit = null, $offset = null)
    {
        $driver = DataSource::getCurrent();
        $sql = 'select
	        SQL_CALC_FOUND_ROWS
            id,
            name,
            description,
            path,
            position
        from
	        module_gallery_item
	    where
	        gallery_id=' . $oGallery->id . ($filterConditions == '' ? '' : " and {$filterConditions}") . (is_null($limit) ? '' : " limit {$limit}") . (is_null($offset) ? '' : " offset {$offset}");
        $driver->query($sql);
        return $driver->fetchAssoc();
    }
Пример #3
0
    public function getCategoriesAndItems($categoryId, $conditions = '', $limit = null, $offset = null)
    {
        $driver = DataSource::getCurrent();
        $sql = 'select
	        SQL_CALC_FOUND_ROWS
	        childs.id,
	        childs.is_category,
	        childs.name,
	        childs.description,
	        case when mcc.name is null then \'Не назначена\' else mcc.name end as category,
	        childs.thumbnail,
	        childs.priority,
	        childs.active,
	        childs.price,
	        childs.count
        from
	        ((select
		        id, true is_category, name, description, category_id, thumbnail, priority, active, null as price, \'-\' as count
	        from
		        module_catalogue_category
	        where
	            deleted = 0
		        and category_id=' . $categoryId . '
	        order by
		        priority)
	        union
	        (select
		        id, false is_category, name, description, category_id, thumbnail, priority, active, price, count
	        from
		        module_catalogue_item
	        where
	            deleted = 0
		        and category_id=' . $categoryId . '
	        order by
		        priority)
	        ) as childs
	        left join module_catalogue_category mcc on mcc.id = childs.category_id
	    ' . (!empty($conditions) ? " where {$conditions}" : '') . '
	    ' . (is_null($limit) ? '' : " limit {$limit}") . '
	    ' . (is_null($offset) ? '' : " offset {$offset}");
        $driver->query($sql);
        return $driver->fetchAssoc();
    }
Пример #4
0
    public function getPages($filterConditions = '', $limit = null, $offset = null)
    {
        $driver = DataSource::getCurrent();
        $sql = 'select
	        SQL_CALC_FOUND_ROWS
            id,
            name,
            description,
            active
        from
	        module_pages
	    where
	        deleted = 0
	    ' . (!empty($filterConditions) ? " and {$filterConditions}" : '') . '
	    ' . (is_null($limit) ? '' : " limit {$limit}") . '
	    ' . (is_null($offset) ? '' : " offset {$offset}");
        $driver->query($sql);
        return $driver->fetchAssoc();
    }
Пример #5
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $ModuleInstaller = new ModuleInstaller();
     $view = new ViewMain();
     /** @var NotificationLog $oNotificationLogs */
     $oNotificationLogs = DataSource::factory(NotificationLog::cls());
     $oNotificationLogs->builder()->order('date', 'desc')->limit(100);
     /** @var NotificationLog[] $aNotificationLogs */
     $aNotificationLogs = $oNotificationLogs->findAll();
     $Select = new Select();
     DataSource::getCurrent()->query($Select->table('notification_log')->field('count(*)', 'count')->build());
     $logsCount = DataSource::getCurrent()->fetchAssoc()[0]['count'];
     $modulesManifests = $ModuleInstaller->findManifests();
     $view->aNotificationLogs = $aNotificationLogs;
     $view->modulesManifests = $modulesManifests;
     $view->logsCount = $logsCount;
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Пример #6
0
 public function clearMainFlag()
 {
     $driver = DataSource::getCurrent();
     $query = 'update structure set is_main=0';
     $driver->query($query);
 }