[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 if (!isset($gCms)) exit; 3 4 global $gCms; 5 $db =& $gCms->GetDb(); 6 /* This code seems like it was copied here from action.default.php Seems unneeded. Commenting out. - Elijah Lofgren 7 $detailpage = ''; 8 if (isset($params['detailpage'])) 9 { 10 $manager =& $gCms->GetHierarchyManager(); 11 $node =& $manager->sureGetNodeByAlias($params['detailpage']); 12 if (isset($node)) 13 { 14 $content =& $node->GetContent(); 15 if (isset($content)) 16 { 17 $detailpage = $content->Id(); 18 } 19 } 20 else 21 { 22 $node =& $manager->sureGetNodeById($params['detailpage']); 23 if (isset($node)) 24 { 25 $detailpage = $params['detailpage']; 26 } 27 } 28 } 29 */ 30 if (!$this->CheckPermission('Modify News')) 31 { 32 echo $this->ShowErrors($this->Lang('needpermission', array('Modify News'))); 33 return; 34 } 35 36 if (isset($params['cancel'])) 37 { 38 $this->Redirect($id, 'defaultadmin', $returnid); 39 } 40 41 $name = ''; 42 if (isset($params['name'])) 43 { 44 $name = $params['name']; 45 if ($name != '') 46 { 47 $catid = $db->GenID(cms_db_prefix()."module_news_categories_seq"); 48 $time = $db->DBTimeStamp(time()); 49 $query = 'INSERT INTO '.cms_db_prefix().'module_news_categories (news_category_id, news_category_name, parent_id, create_date, modified_date) VALUES (?,?,?,'.$time.','.$time.')'; 50 $db->Execute($query, array($catid, $name, $params['parent'])); 51 $this->UpdateHierarchyPositions(); 52 53 @$this->SendEvent('NewsCategoryAdded', array('category_id' => $catid, 'name' => $name)); 54 55 $params = array('tab_message'=> 'categoryadded', 'active_tab' => 'categories'); 56 $this->Redirect($id, 'defaultadmin', $returnid, $params); 57 } 58 else 59 { 60 echo $this->ShowErrors($this->Lang('nonamegiven')); 61 } 62 } 63 64 #Display template 65 $this->smarty->assign('startform', $this->CreateFormStart($id, 'addcategory', $returnid)); 66 $this->smarty->assign('endform', $this->CreateFormEnd()); 67 $this->smarty->assign('nametext', $this->Lang('name')); 68 $this->smarty->assign('inputname', $this->CreateInputText($id, 'name', $name, 20, 255)); 69 $this->smarty->assign('parentdropdown', $this->CreateParentDropdown($id, -1, -1)); 70 $this->smarty->assign('hidden', ''); 71 $this->smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', lang('submit'))); 72 $this->smarty->assign('cancel', $this->CreateInputSubmit($id, 'cancel', lang('cancel'))); 73 $this->smarty->assign('parenttext', lang('parent')); 74 echo $this->ProcessTemplate('editcategory.tpl'); 75 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |