Example #1
0
function arhive()
{
    global $_LANG;
    $model = new cms_model_arhive();
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $pagetitle = $inCore->getComponentTitle();
    $do = $inCore->do;
    $inPage->setTitle($pagetitle);
    $inPage->addPathway($pagetitle, '/arhive');
    //======================================================================================================//
    if ($do == 'view' || $do == 'y') {
        if ($do == 'y') {
            $pagetitle = $_LANG['ARCHIVE_MATERIALS_FROM'] . $model->year . $_LANG['ARHIVE_YEAR'];
            $inPage->addPathway($model->year, '/arhive/' . $model->year);
            $inPage->setTitle($pagetitle);
            $model->whereYearIs();
        }
        $items = $model->getArhiveContent();
        cmsPage::initTemplate('components', 'com_arhive_dates')->assign('pagetitle', $pagetitle)->assign('items', $items)->assign('do', $do)->display('com_arhive_dates.tpl');
    }
    //======================================================================================================//
    if ($do == 'ymd' || $do == 'ym') {
        $month_name = cmsCore::intMonthToStr($model->month);
        $inPage->addPathway($model->year, '/arhive/' . $model->year);
        $inPage->addPathway($month_name, '/arhive/' . $model->year . '/' . $model->month);
        if ($do == 'ymd') {
            $inPage->addPathway($model->day, '/arhive/' . $model->year . '/' . $model->month . '/' . $model->day);
            $pagetitle = $_LANG['ARCHIVE_MATERIALS_FROM'] . $model->day . ' ' . $_LANG['MONTH_' . $model->month] . ' ' . $model->year . $_LANG['ARHIVE_YEARS'];
            $model->whereDayIs();
        } else {
            $pagetitle = $_LANG['ARCHIVE_MATERIALS_FROM'] . $month_name . ' ' . $model->year . $_LANG['ARHIVE_YEARS'];
            $model->whereMonthIs();
        }
        $inPage->setTitle($pagetitle);
        $model->setArtticleSql();
        $items = $model->getArhiveContent();
        cmsPage::initTemplate('components', 'com_arhive_list')->assign('pagetitle', $pagetitle)->assign('items', $items)->display('com_arhive_list.tpl');
    }
}
Example #2
0
function mod_arhive($module_id, $cfg)
{
    cmsCore::loadModel('arhive');
    $model = new cms_model_arhive();
    $model->whereThisAndNestedCats(@$cfg['cat_id']);
    if ($model->year != 'all') {
        $model->whereYearIs();
    }
    $items = $model->getArhiveContent();
    if (!$items) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_arhive')->assign('arhives', $items)->assign('date', array('year' => $model->year, 'month' => $model->month, 'day' => $model->day))->display('mod_arhive.tpl');
    return true;
}