Viewing file: module.php (3.02 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? class Informers { var $UserMode = false; var $AdminMode = true; var $AdminAsynchMode = true; var $SearchMode = false; var $PanelMode = true; var $Table; var $Directory; var $FilesDirectory; var $ClassName = 'Informers'; function Informers() { $this->Directory = dirname(__FILE__); $this->Table = new AMTable2('AMCMS_informers'); $this->Table->AddIndexField('informer_id'); $this->Table->Module($this->ClassName); $this->Table->AddPositionField("informer_position"); } function User() { global $language, $ULANG; } function Menu() { global $ALANG; if (isset($_GET['mod']) && ($_GET['mod'] == __CLASS__)) { return array( array('title' => $ALANG['InformerMenuAdd'], 'link' => '?mod='.__CLASS__.'&add'), array('title' => $ALANG['InformerMenuList'], 'link' => '?mod='.__CLASS__.'&list'), ); } else return ""; } function AdminAsynch() { $this->Table->Run($_POST); } function Admin() { global $ALANG, $alang; $smarty = GetAdminSmarty($this->ClassName); if (isset($_GET['list'])) { $fields = array("informer_title_".GetParam("DefaultLanguage")); $captions = array($ALANG['Informers_informer_title']); $order = "informer_position DESC"; $links = array("checkbox", "delete", "edit"); $params = array("sortable" => "yes", "id" => "actual"); $multiple = array("delete"); $html = $this->Table->GetAdminTable($fields, $captions, $conditions, $order, $links, $multiple, $params); $result['Title'] = $ALANG['InformerList']; $result['Content'] = $html; return $result; } if (isset($_GET['add'])) { if (isset($_POST['add'])) { $id = $this->Table->Insert($_POST); header("Location: admin.php?mod={$this->ClassName}&list"); } foreach($_POST as $key => $value) $smarty->assign($key, $value); $smarty->assign('oper', 'add'); $result['Title'] = $ALANG['InformerAdd']; $result['Content'] = $smarty->fetch('informer.tpl'); return $result; } if (isset($_GET['edit']) && isset($_GET['informer_id'])) { if (isset($_POST['edit'])) { $error = $this->Table->Update($_POST, $_GET['informer_id']); header("Location: admin.php?mod={$this->ClassName}&list"); } $row = $this->Table->GetRowById($_GET['informer_id']); foreach($row as $key => $value) $smarty->assign($key, $value); $smarty->assign('oper', 'edit'); $result['Title'] = $ALANG['InformerEdit']; $result['Content'] = $smarty->fetch('informer.tpl'); return $result; } } function Panel() { global $ULANG, $ulang; $rows = $this->Table->GetRows(); $num = 1; foreach($rows as $key => $row) { $result["Informer{$row['informer_id']}"] = array('Title' => $row['informer_title_'.$ulang], 'Content' => $row['informer_code_'.$ulang], 'Module' => $this->ClassName, 'class' => "{$row['informer_class']}" ); $num++; } return $result; } }
$Modules [] = new Informers(); ?>
|