[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/News/ -> action.defaultadmin.php (source)

   1  <?php
   2  if (!isset($gCms)) exit;
   3  #The tabs
   4  echo $this->StartTabHeaders();
   5  if (FALSE == empty($params['active_tab']))
   6  {
   7      $tab = $params['active_tab'];
   8  } else {
   9      $tab = '';
  10  }
  11  if ($this->CheckPermission('Modify News'))
  12  {
  13      echo $this->SetTabHeader('articles',$this->Lang('articles'), ('articles' == $tab)?true:false);
  14      echo $this->SetTabHeader('categories',$this->Lang('categories'), ('categories' == $tab)?true:false);
  15  }
  16                      
  17  if ($this->CheckPermission('Modify Templates'))
  18  {
  19      echo $this->SetTabHeader('summary_template',$this->Lang('summarytemplate'), ('summary_template' == $tab)?true:false);
  20      echo $this->SetTabHeader('detail_template',$this->Lang('detailtemplate'), ('detail_template' == $tab)?true:false);
  21  }
  22              
  23  if ($this->CheckPermission('Modify Site Preferences'))
  24  {
  25      echo $this->SetTabHeader('options',$this->Lang('options'), ('options' == $tab)?true:false);
  26  }
  27  echo $this->EndTabHeaders();
  28  
  29  #The content of the tabs
  30  echo $this->StartTabContent();
  31  if ($this->CheckPermission('Modify News'))
  32  {
  33      echo $this->StartTab('articles', $params);
  34      echo $this->CreateFormStart($id, 'defaultadmin');
  35      
  36      $curcategory = (isset($params['curcategory'])?$params['curcategory']:'');
  37      $allcategories = (isset($params['allcategories'])?$params['allcategories']:'no');
  38      $newcategory = $curcategory;
  39      
  40      if (isset($params['submitcategory']))
  41      {
  42          $newcategory = (isset($params['newcategory'])?$params['newcategory']:$newcategory);
  43      }
  44      
  45      $curcategory = $newcategory;
  46      $categorylist = array();
  47      $categorylist[$this->Lang('allcategories')] = '';
  48      $query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
  49      $dbresult = $db->Execute($query);
  50      
  51      while ($dbresult && $row = $dbresult->FetchRow())
  52      {
  53          $categorylist[$row['long_name']] = $row['long_name'];
  54      }
  55      
  56      echo '<p>'.$this->Lang('category').': ' . $this->CreateInputDropdown($id, 'newcategory', $categorylist, -1, $newcategory) . ' ' . $this->Lang('showchildcategories') . ': ' . $this->CreateInputCheckbox($id, 'allcategories', 'yes', $allcategories) . ' ' . $this->CreateInputSubmit($id, 'submitcategory', $this->Lang('selectcategory')) . $this->CreateInputHidden($id, 'curcategory', $curcategory) . '</p>';
  57      
  58      echo $this->CreateFormEnd();
  59      
  60      //Load the current articles
  61      $entryarray = array();
  62      
  63      $query = '';
  64      $dbresult = '';
  65      
  66      if ($curcategory != '')
  67      {
  68          $query = "SELECT n.*, nc.long_name FROM ".cms_db_prefix()."module_news n LEFT OUTER JOIN ".cms_db_prefix()."module_news_categories nc ON n.news_category_id = nc.news_category_id WHERE nc.long_name LIKE ? ORDER by news_date DESC";
  69          if ($allcategories == 'yes')
  70          {
  71              $dbresult = $db->Execute($query,array($curcategory . '%'));
  72          }
  73          else
  74          {
  75              $dbresult = $db->Execute($query,array($curcategory));
  76          }
  77      }
  78      else
  79      {
  80          $query = "SELECT n.*, nc.long_name FROM ".cms_db_prefix()."module_news n LEFT OUTER JOIN ".cms_db_prefix()."module_news_categories nc ON n.news_category_id = nc.news_category_id ORDER by news_date DESC";
  81          $dbresult = $db->Execute($query);
  82      }
  83      
  84      $rowclass = 'row1';
  85      
  86      while ($dbresult && $row = $dbresult->FetchRow())
  87      {
  88          $onerow = new stdClass();
  89      
  90          $onerow->id = $row['news_id'];
  91          $onerow->title = $this->CreateLink($id, 'editarticle', $returnid, $row['news_title'], array('articleid'=>$row['news_id']));
  92          $onerow->data = $row['news_data'];
  93          $onerow->postdate = $row['news_date'];
  94          $onerow->startdate = $row['start_time'];
  95          $onerow->enddate = $row['end_time'];
  96          $onerow->category = $row['long_name'];
  97          $onerow->rowclass = $rowclass;
  98      
  99          $onerow->editlink = $this->CreateLink($id, 'editarticle', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $this->Lang('edit'),'','','systemicon'), array('articleid'=>$row['news_id']));
 100          $onerow->deletelink = $this->CreateLink($id, 'deletearticle', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'),'','','systemicon'), array('articleid'=>$row['news_id']), $this->Lang('areyousure'));
 101      
 102          $entryarray[] = $onerow;
 103      
 104          ($rowclass=="row1"?$rowclass="row2":$rowclass="row1");
 105      }
 106      
 107      $this->smarty->assign_by_ref('items', $entryarray);
 108      $this->smarty->assign('itemcount', count($entryarray));
 109      
 110      $this->smarty->assign('addlink', $this->CreateLink($id, 'addarticle', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/newobject.gif', $this->Lang('addarticle'),'','','systemicon'), array(), '', false, false, '') .' '. $this->CreateLink($id, 'addarticle', $returnid, $this->Lang('addarticle'), array(), '', false, false, 'class="pageoptions"'));
 111      
 112      $this->smarty->assign('titletext', $this->Lang('title'));
 113      $this->smarty->assign('postdatetext', $this->Lang('postdate'));
 114      $this->smarty->assign('categorytext', $this->Lang('category'));
 115      
 116      #Display template
 117      echo $this->ProcessTemplate('articlelist.tpl');
 118      
 119      echo $this->EndTab();
 120      
 121      echo $this->StartTab('categories', $params);
 122      
 123      #Put together a list of current categories...
 124      $entryarray = array();
 125      
 126      $query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
 127      $dbresult = $db->Execute($query);
 128      
 129      $rowclass = 'row1';
 130      
 131      while ($dbresult && $row = $dbresult->FetchRow())
 132      {
 133          $onerow = new stdClass();
 134      
 135          $depth = count(split('\.', $row['hierarchy']));
 136      
 137          $onerow->id = $row['news_category_id'];
 138          $onerow->name = str_repeat('&nbsp;&gt;&nbsp;', $depth-1).$this->CreateLink($id, 'editcategory', $returnid, $row['news_category_name'], array('catid'=>$row['news_category_id']));
 139      
 140          $onerow->editlink = $this->CreateLink($id, 'editcategory', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $this->Lang('edit'),'','','systemicon'), array('catid'=>$row['news_category_id']));
 141          $onerow->deletelink = $this->CreateLink($id, 'deletecategory', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'),'','','systemicon'), array('catid'=>$row['news_category_id']), $this->Lang('areyousure'));
 142      
 143          $onerow->rowclass = $rowclass;
 144  
 145          $entryarray[] = $onerow;
 146      
 147          ($rowclass=="row1"?$rowclass="row2":$rowclass="row1");
 148      }
 149      
 150      $this->smarty->assign_by_ref('items', $entryarray);
 151      $this->smarty->assign('itemcount', count($entryarray));
 152      
 153      #Setup links
 154      $this->smarty->assign('addlink', $this->CreateLink($id, 'addcategory', $returnid, $this->Lang('addcategory'), array(), '', false, false, 'class="pageoptions"'));
 155      $this->smarty->assign('addlink', $this->CreateLink($id, 'addcategory', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/newfolder.gif', $this->Lang('addcategory'),'','','systemicon'), array(), '', false, false, '') .' '. $this->CreateLink($id, 'addcategory', $returnid, $this->Lang('addcategory'), array(), '', false, false, 'class="pageoptions"'));
 156      
 157      $this->smarty->assign('categorytext', $this->Lang('category'));
 158      
 159      #Display template
 160      echo $this->ProcessTemplate('categorylist.tpl');
 161      
 162      echo $this->EndTab();
 163  }
 164  if( $this->CheckPermission( 'Modify Templates' ) )
 165  {
 166      echo $this->StartTab('summary_template', $params);
 167      
 168      echo $this->CreateFormStart($id, 'updatesummarytemplate');
 169      
 170      echo '<p>'.$this->CreateTextArea(false, $id, $this->GetTemplate('displaysummary'), 'templatecontent', 'pagebigtextarea').'</p>';
 171      
 172      echo $this->CreateInputSubmit($id, 'submitbutton', $this->Lang('submit'));
 173      echo $this->CreateInputSubmit($id, 'defaultsbutton', $this->Lang('sysdefaults'), '', '', $this->Lang('restoretodefaultsmsg'));
 174      
 175      echo $this->CreateFormEnd();
 176      
 177      echo $this->EndTab();
 178      
 179      echo $this->StartTab('detail_template', $params);
 180      
 181      echo $this->CreateFormStart($id, 'updatedetailtemplate');
 182      
 183      echo '<p>'.$this->CreateTextArea(false, $id, $this->GetTemplate('displaydetail'), 'templatecontent2', 'pagebigtextarea').'</p>';
 184      
 185      echo $this->CreateInputSubmit($id, 'rsssubmitbutton', $this->Lang('submit'));
 186      echo $this->CreateInputSubmit($id, 'defaultsbutton', $this->Lang('sysdefaults'), '', '', $this->Lang('restoretodefaultsmsg'));
 187      
 188      echo $this->CreateFormEnd();
 189      
 190      echo $this->EndTab();
 191  }
 192  
 193  if ($this->CheckPermission('Modify Site Preferences'))
 194  {
 195      echo $this->StartTab('options', $params);
 196      
 197      // CreateFormStart sets up a proper form tag that will cause the submit to
 198      // return control to this module for processing.
 199      $this->smarty->assign('startform', $this->CreateFormStart ($id, 'updateoptions', $returnid));
 200      $this->smarty->assign('endform', $this->CreateFormEnd ());
 201  
 202      $this->smarty->assign ('title_showautodiscovery', $this->Lang('showautodiscovery'));
 203      $this->smarty->assign('input_showautodiscovery', $this->CreateInputCheckbox($id, 'showautodiscovery', 'yes', $this->GetPreference('showautodiscovery', 'yes')));
 204  
 205      $this->smarty->assign ('title_autodiscoverylink', $this->Lang('autodiscoverylink'));
 206      $this->smarty->assign('input_autodiscoverylink', $this->CreateInputText($id, 'autodiscoverylink', $this->GetPreference('autodiscoverylink', ''), '50', '255'));
 207  
 208      $this->smarty->assign('title_dateformat', $this->Lang('helpdateformat'));
 209      $this->smarty->assign('input_dateformat', $this->CreateInputText($id, 'dateformat', $this->GetPreference('dateformat', ''), '50', '255'));
 210  
 211      $categorylist = array();
 212      $query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
 213      $dbresult = $db->Execute($query);
 214  
 215      while ($dbresult && $row = $dbresult->FetchRow())
 216      {
 217          $categorylist[$row['long_name']] = $row['news_category_id'];
 218      }
 219  
 220      $this->smarty->assign('title_default_category', $this->Lang('default_category'));
 221      $this->smarty->assign('input_default_category', $this->CreateInputDropdown($id, 'default_category', $categorylist, -1, $this->GetPreference('default_category', '')));
 222  
 223      $this->smarty->assign('submit', $this->CreateInputSubmit ($id, 'optionssubmitbutton', $this->Lang('submit')));
 224  
 225      // Display the populated template
 226      echo $this->ProcessTemplate ('adminprefs.tpl');
 227      echo $this->EndTab();
 228  }
 229  
 230  echo $this->EndTabContent();
 231  
 232  # vim:ts=4 sw=4 noet
 233  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7