Inheritance: extends ListObject
/**
 * Campsite list_sections block plugin
 *
 * Type:     block
 * Name:     list_sections
 * Purpose:  Provides a...
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_list_sections($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    $p_smarty->smarty->loadPlugin('smarty_shared_escape_special_chars');
    $campContext = $p_smarty->getTemplateVars('gimme');
    if (!isset($p_content)) {
        $start = $campContext->next_list_start('SectionsList');
        $sectionsList = new SectionsList($start, $p_params);
        if ($sectionsList->isEmpty()) {
            $campContext->setCurrentList($sectionsList, array());
            $campContext->resetCurrentList();
            $p_repeat = false;
            return null;
        }
        $campContext->setCurrentList($sectionsList, array('publication', 'language', 'issue', 'section', 'article', 'image', 'attachment', 'comment', 'subtitle'));
        $campContext->section = $campContext->current_sections_list->current;
        $p_repeat = true;
    } else {
        $campContext->current_sections_list->defaultIterator()->next();
        if (!is_null($campContext->current_sections_list->current)) {
            $campContext->section = $campContext->current_sections_list->current;
            $p_repeat = true;
        } else {
            $campContext->resetCurrentList();
            $p_repeat = false;
        }
    }
    return $p_content;
}
Esempio n. 2
0
 public function updateTechmap($id, $serial, $descript, $model, $time, $section)
 {
     $instModel = new ModelsList($this->connDB);
     if ($ml_id = $instModel->setId($model)) {
         $ml_id = $instModel->addModel($model);
     }
     $instSection = new SectionsList($this->connDB);
     if ($instSection->setId($section)) {
         $ml_id = $instSection->getId();
     } else {
         $instSection->addModel($section);
         $sl_id = $instSection->lastId;
     }
     $sql = "UPDATE `ns_techmap` SET \n            `serial`='{$serial}',\n            `descript`='{$descript}',\n            `ml_id`='{$ml_id}',\n            `time`='{$time}',\n            `sl_id`='{$sl_id}'\n            WHERE `t_id`='{$id}'";
     //echo "sql=".$sql;
     $res = mysql_query($sql, $this->connDB) or die("Ошибка выполнения: " . $sql . " errors: " . mysql_error());
     if (0 == $res) {
         return false;
     }
     if ($res > 0) {
         return true;
     }
 }