Exemplo n.º 1
0
    if (isset($fields[$fieldID])) {
        CMS_session::setSessionVar('items_' . $object->getID() . '_' . $fieldID, $fields[$fieldID]);
    }
}
// Date format
$dateFormat = $cms_language->getDateFormat();
// d/m/Y
// +----------------------------------------------------------------------+
// | Build search                                                         |
// +----------------------------------------------------------------------+
//create search object for current object
$search = new CMS_object_search($object);
//if object is a primary resource
if ($object->isPrimaryResource()) {
    //Order
    $search->setAttribute('orderBy', 'publicationDateStart_rs desc,publicationDateEnd_rs desc, id_moo desc');
    // Param : Around publication date
    $dt_today = new CMS_date();
    $dt_today->setDebug(false);
    $dt_today->setNow();
    $dt_today->setFormat($dateFormat);
    $dt_from = new CMS_date();
    $dt_from->setDebug(false);
    $dt_from->setFormat($dateFormat);
    if ($dt_from->setLocalizedDate(CMS_session::getSessionVar("items_dtfrm"), true)) {
        $search->addWhereCondition("publication date after", $dt_from);
    }
    $dt_end = new CMS_date();
    $dt_end->setDebug(false);
    $dt_end->setFormat($dateFormat);
    if ($dt_end->setLocalizedDate(CMS_session::getSessionVar("items_dtnd"), true)) {