Пример #1
0
 public function showProducts()
 {
     $params = explode('=', $this->_data['id']);
     $linkdata = SESSION::Instance();
     $selectedproduct = empty($_SESSION['selectedproducts']) ? array() : $_SESSION['selectedproducts'];
     if (isset($selectedproduct[$params[0]])) {
         if (strtolower($params[1]) == 'false') {
             unset($selectedproduct[$params[0]]);
         }
     } elseif (strtolower($params[1]) == 'true') {
         $selectedproduct[$params[0]] = true;
     }
     $_SESSION['selectedproducts'] = $selectedproduct;
     $selectedproducts = new SOProductLineCollection(DataObjectFactory::Factory('SOProductLine'));
     if (!empty($selectedproduct)) {
         $sh = new SearchHandler($selectedproducts, false);
         $sh->addConstraint(new Constraint('id', 'in', '(' . implode(',', array_keys($selectedproduct)) . ')'));
         $selectedproducts->load($sh);
     }
     $this->view->set('productlines', $selectedproducts);
 }
Пример #2
0
 public function show_auth_accounts()
 {
     if (isset($this->_data['id'])) {
         $params = explode('=', $this->_data['id']);
     } else {
         $params = array();
     }
     $linkdata = SESSION::Instance();
     $selected_account = array();
     if (!empty($params)) {
         if (isset($selected_account[$params[0]])) {
             if (strtolower($params[1]) == 'false') {
                 unset($selected_account[$params[0]]);
             }
         } elseif (strtolower($params[1]) == 'true') {
             $selected_account[$params[0]] = true;
         }
     }
     $selected_accounts = new GLAccountCollection();
     if (!empty($selected_account)) {
         $sh = new SearchHandler($selected_accounts, false);
         $sh->addConstraint(new Constraint('id', 'in', '(' . implode(',', array_keys($selected_account)) . ')'));
         $selected_accounts->load($sh);
     }
     $this->view->set('selected_accounts', $selected_accounts);
 }
Пример #3
0
 public function selected_targets()
 {
     $targets = explode('^', $this->_data['id']);
     foreach ($targets as $key => $value) {
         if (!empty($value)) {
             unset($params);
             $params = explode(',', $value);
             // open up the first record
             $first_value = explode('=', $params[0]);
             $linkdata = SESSION::Instance();
             $selected_targets = empty($_SESSION['selected_targets']['data']) ? array() : $_SESSION['selected_targets']['data'];
             $deleted_targets = empty($_SESSION['selected_targets']['delete']) ? array() : $_SESSION['selected_targets']['delete'];
             if (isset($selected_targets[$first_value[0]])) {
                 if (strtolower($first_value[1]) == 'false') {
                     $deleted_targets[$first_value[0]] = $selected_targets[$first_value[0]];
                     unset($selected_targets[$first_value[0]]);
                 }
             } elseif (strtolower($first_value[1]) == 'true') {
                 $count = 0;
                 foreach ($params as $key => $value) {
                     $values = explode('=', $value);
                     if ($count > 0) {
                         $selected_targets[$first_value[0]][$values[0]] = $values[1];
                     }
                     $count++;
                 }
                 unset($deleted_targets[$first_value[0]]);
             }
             $_SESSION['selected_targets']['data'] = $selected_targets;
             $_SESSION['selected_targets']['delete'] = $deleted_targets;
             $selected_target_headings = empty($_SESSION['selected_targets']['headings']) ? array() : $_SESSION['selected_targets']['headings'];
         }
     }
     $this->view->set('selected_targets', $selected_targets);
     $this->view->set('selected_target_headings', $selected_target_headings);
 }