Beispiel #1
0
});
$wordCount = Definition::getWordCount();
$wordCountRough = $wordCount - $wordCount % 10000;
SmartyWrap::assign('page_title', 'Dicționar explicativ al limbii române');
SmartyWrap::assign('onHomePage', '1');
SmartyWrap::assign('letters', preg_split('//u', 'aăâbcdefghiîjklmnopqrsștțuvwxyz'));
SmartyWrap::assign('words_total', util_formatNumber($wordCount, 0));
SmartyWrap::assign('words_rough', util_formatNumber($wordCountRough, 0));
SmartyWrap::assign('words_last_month', util_formatNumber(Definition::getWordCountLastMonth(), 0));
SmartyWrap::assign('widgets', $widgets);
SmartyWrap::assign('numEnabledWidgets', $numEnabledWidgets);
/* WotD part */
$wotd = WordOfTheDay::getTodaysWord();
if (!$wotd) {
    WordOfTheDay::updateTodaysWord();
    $wotd = WordOfTheDay::getTodaysWord();
}
$defId = WordOfTheDayRel::getRefId($wotd->id);
$def = Model::factory('Definition')->where('id', $defId)->where('status', ST_ACTIVE)->find_one();
SmartyWrap::assign('thumbUrl', $wotd->getThumbUrl());
SmartyWrap::assign('title', $def->lexicon);
SmartyWrap::assign('today', date('Y/m/d'));
/* WotM part */
$wotm = WordOfTheMonth::getCurrentWotM();
$def = Model::factory('Definition')->where('id', $wotm->definitionId)->where('status', ST_ACTIVE)->find_one();
SmartyWrap::assign('thumbUrlM', $wotm->getThumbUrl());
SmartyWrap::assign('articol', $wotm->article);
SmartyWrap::assign('titleM', $def->lexicon);
SmartyWrap::assign('todayM', date('Y/m'));
$page = Config::get('global.aprilFoolsDay') ? 'index-afd.ihtml' : 'index.ihtml';
SmartyWrap::displayPageWithSkin($page);
Beispiel #2
0
<?php

WordOfTheMonth::$IMAGE_CREDITS_DIR = util_getRootPath() . 'docs/imageCredits';
class WordOfTheMonth extends BaseObject
{
    public static $_table = 'WordOfTheMonth';
    public static $DEFAULT_IMAGE = 'generic.jpg';
    public static $IMAGE_CREDITS_DIR;
    public static function getWotM($date)
    {
        return Model::factory('WordOfTheMonth')->where_lte('displayDate', $date)->order_by_desc('displayDate')->limit(1)->find_one();
    }
    public static function getCurrentWotM()
    {
        return Model::factory('WordOfTheMonth')->where_raw('displayDate <= curdate()')->order_by_desc('displayDate')->limit(1)->find_one();
    }
    public function getImageUrl()
    {
        if ($this->image) {
            return Config::get('static.url') . 'img/wotd/cuvantul-lunii/' . $this->image;
        }
        return null;
    }
    public function getThumbUrl()
    {
        $pic = $this->image ? $this->image : self::$DEFAULT_IMAGE;
        return Config::get('static.url') . 'img/wotd/cuvantul-lunii/thumb/' . $pic;
    }
    public function getArtist()
    {
        return $this->image ? WotdArtist::getByDate($this->displayDate, true) : null;
Beispiel #3
0
<?php

define('WOTM_BIG_BANG', '2012-04-01');
require_once "../phplib/util.php";
$date = util_getRequestParameter('d');
$type = util_getRequestParameter('t');
$today = date('Y-m-01', time());
// Always use the first of the month
$timestamp = $date ? strtotime($date) : time();
$mysqlDate = date("Y-m-01", $timestamp);
if ($mysqlDate < WOTM_BIG_BANG || $mysqlDate > $today && !util_isModerator(PRIV_ADMIN)) {
    util_redirect(util_getWwwRoot() . 'cuvantul-lunii');
}
$wotm = WordOfTheMonth::getWotM($mysqlDate);
$def = Definition::get_by_id($wotm->definitionId);
if ($type == 'url') {
    SmartyWrap::assign('today', $today);
    SmartyWrap::assign('title', $def->lexicon);
    SmartyWrap::displayWithoutSkin('bits/wotmurl.tpl');
    exit;
}
$searchResults = SearchResult::mapDefinitionArray(array($def));
$cYear = date('Y', $timestamp);
$cMonth = date('n', $timestamp);
$nextTS = mktime(0, 0, 0, $cMonth + 1, 1, $cYear);
$prevTS = mktime(0, 0, 0, $cMonth - 1, 1, $cYear);
if ($mysqlDate > WOTM_BIG_BANG) {
    SmartyWrap::assign('prevmon', date('Y/m', $prevTS));
}
if ($mysqlDate < $today || util_isModerator(PRIV_ADMIN)) {
    SmartyWrap::assign('nextmon', date('Y/m', $nextTS));
<?php

WordOfTheMonth::$IMAGE_DESCRIPTION_DIR = util_getRootPath() . 'docs/imageCredits';
class WordOfTheMonth extends BaseObject
{
    public static $_table = 'WordOfTheMonth';
    public static $IMAGE_DESCRIPTION_DIR;
    public static function getWotM($date)
    {
        return Model::factory('WordOfTheMonth')->where_lte('displayDate', $date)->order_by_desc('displayDate')->limit(1)->find_one();
    }
    public static function getCurrentWotM()
    {
        return Model::factory('WordOfTheMonth')->where_raw('displayDate <= curdate()')->order_by_desc('displayDate')->limit(1)->find_one();
    }
    public function getImageUrl()
    {
        if ($this->image) {
            return Config::get('static.url') . 'img/wotd/cuvantul-lunii/' . $this->image;
        }
        return null;
    }
    public function getThumbUrl()
    {
        if ($this->image) {
            return Config::get('static.url') . 'img/wotd/cuvantul-lunii/thumb/' . $this->image;
        }
        return null;
    }
    public function getImageCredits()
    {