Caravel CMS PHP Cross Reference Content Management Systems

Source: /apps/ECommerce/ECAdmin/ECAdmin.php - 100 lines - 5146 bytes - Summary - Text - Print

   1  <?php
   2  require_once(T_APP_BASE . 'ECommerce/eccorefunctions.php');
   3  require_once ('Inventory.php');
   4  require_once ('Order.php');
   5  require_once(T_APP_BASE . 'ECommerce/ECItem/ECItem.php');
   6  require_once (T_CODE_BASE . 'Security.php');
   7  is_file(T_APP_BASE .'ECommerce/ECAdmin/Transactiontmp.php')? require_once('Transactiontmp.php') : require_once('Transaction.php');
   8  is_file(T_APP_BASE .'ECommerce/ECAdmin/AdmApprovaltmp.php')? require_once('AdmApprovaltmp.php') : require_once('AdmApproval.php'); 
   9  
  10  class ECAdmin extends App
  11    {
  12    function getContent()
  13      {
  14      if(T_EXTERNAL_AUTH)
  15          $user = T_LDAP_AUTH_USER_ATTR."=".$_SESSION['auth']->username.",".T_LDAP_AUTH_USER_BASE;
  16      else
  17          $user = T_LDAP_USER_ATTR."=".$_SESSION['auth']->username.",".T_LDAP_USER_BASE;
  18                         
  19      if(!in_array("Ecommerce Admin", Security::getSiteGroups(T_ORG_DN, $this->ldap)))
  20        {
  21        //create Ecommerce Admin group
  22        Security::add_group("cn=Ecommerce Admin,ou=cvgroups,".T_ORG_DN, "default", "default", $this->ldap);
  23        Security::remove_member(T_USER, "cn=Ecommerce Admin,ou=cvgroups,".T_ORG_DN, $this->ldap);
  24        }
  25  
  26      if((!Security::isUserInGroups($user, 'cn=Ecommerce Admin,ou=cvgroups,'.T_LDAP_BASE, $this->ldap) && !Security::isUserInGroups('uid='.T_USER.',ou=people,'.T_LDAP_BASE, 'cn=Ecommerce Admin,ou=cvgroups,'.T_LDAP_BASE, $this->ldap)) &&
  27          !Security::isUserInGroups($user, 'cn=Ecommerce Admin,ou=cvgroups,'.T_ORG_DN, $this->ldap) && !Security::isUserInGroups('uid='.T_USER.',ou=people,'.T_LDAP_BASE, 'cn=Ecommerce Admin,ou=cvgroups,'.T_ORG_DN, $this->ldap))
  28        return "You must be a member of Ecommerce Admin group to use this application";
  29        
  30      if($this->params['itempopupidentification'] == 1)
  31        {
  32        $this->edit=1;
  33        $this->noBlock = true;
  34        return Inventory::getInventorySingle();
  35        }  
  36        
  37      $tpl = new Template_PHPLIB(T_APP_BASE . "ECommerce/ECAdmin");
  38      $tpl->setFile(array('main' => '/admin.tpl.html'));
  39      
  40      // set the paramnames
  41      $tpl->setVar('current_tab', $this->paramName('current_tab'));
  42  
  43      // set the widget fields to give it that classy caravel look
  44      $tpl->setVar('form_look_begin', Widget::form_look('', '', 'beginning'));
  45      $tpl->setVar('form_look_end', Widget::form_look('', '', 'end'));
  46      if($this->params['current_tab'] == "")
  47        $this->params['current_tab'] = "inventory";
  48        
  49      if($this->params['current_tab'] == "inventory")
  50        $tab = 0;
  51      else if($this->params['current_tab'] == "orders")  
  52        $tab = 1;
  53      else if($this->params['current_tab'] == "transactions")
  54        $tab = 2;
  55      else
  56        $tab = 3;
  57      if(T_ORG_DN == "dc=gcnavigator,dc=www,dc=goshen,dc=edu")
  58        $tpl->setVar('ec_tabs', Widget::tabs(array(0 => 'Inventory', 1 => 'Orders', 2 => 'Transactions', 3 => 'Admission'), $tab, 
  59                                           array(0 => 'document.ec_admin.'.$this->paramName("current_tab").'.value = \'inventory\';
  60                                                       document.ec_admin.submit();',
  61                                                 1 => 'document.ec_admin.'.$this->paramName("current_tab").'.value = \'orders\';
  62                                                       document.ec_admin.submit();',
  63                                                 2 => 'document.ec_admin.'.$this->paramName("current_tab").'.value = \'transactions\';
  64                                                       document.ec_admin.submit();',
  65                             3 => 'document.ec_admin.'.$this->paramName("current_tab").'.value = \'admission\';
  66                                                       document.ec_admin.submit();')));
  67      else
  68        $tpl->setVar('ec_tabs', Widget::tabs(array(0 => 'Inventory', 1 => 'Orders', 2 => 'Transactions'), $tab, 
  69                                           array(0 => 'document.ec_admin.'.$this->paramName("current_tab").'.value = \'inventory\';
  70                                                       document.ec_admin.submit();',
  71                                                 1 => 'document.ec_admin.'.$this->paramName("current_tab").'.value = \'orders\';
  72                                                       document.ec_admin.submit();',
  73                                                 2 => 'document.ec_admin.'.$this->paramName("current_tab").'.value = \'transactions\';
  74                                                       document.ec_admin.submit();')));
  75      $tpl->setVar('current_tab_val', $this->params['current_tab']);
  76      $tpl->setVar('linktoself', $this->linktoself());
  77      
  78      if($this->params['current_tab'] == "inventory")
  79        $tpl->setVar('form_content', Inventory::create());
  80      else if($this->params['current_tab'] == "orders")  
  81        $tpl->setVar('form_content', Order::create());
  82      else if($this->params['current_tab'] == "transactions")
  83        $tpl->setVar('form_content', Transaction::create());
  84      else
  85        $tpl->setVar('form_content', AdmApproval::create());  
  86      return $tpl->subst('main');
  87      }
  88      
  89      
  90    function onInit()
  91      {
  92      $this->mode = isset($this->httpVars['mode']) ? $this->httpVars['mode'] : '';
  93      } 
  94       
  95    function onSave()
  96      {
  97      ECItem::onSave();
  98      }
  99    }
 100  ?>

title

Description

title

Description

title

Description

title

title

Body