/**
  *
  * @access public
  * @param  integer handle of object to return
  * @return mixed
  *
  */
 function &getObject($handle)
 {
     $me =& ObjectHandler::getInstance();
     if (!isset($me->_list[$handle])) {
         Amber::showError('ObjectHandler::getObject()', 'Invalid handle: [' . $handle . ']');
         return null;
     }
     return $me->_list[$handle];
 }
Example #2
0
 public function setUp()
 {
     parent::setup();
     $this->_model = Mage::getModel('ops/payment_cc');
     $this->_payment = ObjectHandler::getObject('quoteBeforeSaveOrder')->getPayment();
 }
Example #3
0
 function printNormal()
 {
     if (!$this->SourceObject) {
         $this->_exporter->printNormal($this, '');
         return $this->stdHeight();
     }
     // Convert SourceObject to name and type
     $source = explode('.', $this->SourceObject);
     $type = $source[0];
     $name = $source[1];
     // Try to load report
     $amber =& Amber::getInstance();
     $rep =& ObjectHandler::getObject($this->_hReport);
     $mgr =& $amber->getObjectManager();
     $this->_subReport =& $mgr->loadReport($name);
     if (!$this->_subReport) {
         $this->_exporter->printNormal($this, '');
         return $this->stdHeight();
     }
     // Construct filter
     if ($this->LinkChildFields != null && $this->LinkMasterFields != null) {
         $linkChild = explode(';', $this->LinkChildFields);
         $linkMaster = explode(';', $this->LinkMasterFields);
         foreach ($linkChild as $idx => $lchild) {
             $lmaster = $linkMaster[$idx];
             if (!array_key_exists($lmaster, $rep->Cols)) {
                 Amber::showError('Error', 'LinkMasterField "' . htmlspecialchars($lmaster) . '" does not exist.');
                 die;
             }
             $value = $rep->Cols[$lmaster];
             // FIXME:
             // - filter value has to be handled according to it's type
             //   We need to have the recordset instead of a plain array here
             if ($value === null) {
                 $reportFilterArray[] = '(' . $lchild . ' is null)';
             } else {
                 $reportFilterArray[] = '(' . $lchild . '=' . $rep->Cols[$lmaster] . ')';
             }
         }
         $this->_subReport->Filter = implode(' AND ', $reportFilterArray);
     }
     $this->_subReport->setSubReport(true);
     $this->_subReport->run($rep->exporterType);
     // Adjust control height before passing it to the exporter
     $originalHeight = $this->Height;
     $requestedHeight = $this->Height;
     $subReportHeight = $this->_subReport->getTotalHeight();
     if ($this->CanShrink) {
         if ($subReportHeight == 0) {
             // No output at all
             return 0;
         }
         // Shrink
         if ($this->Height > $subReportHeight) {
             $requestedHeight = $subReportHeight;
         }
     }
     // Grow
     if ($this->CanGrow && $this->Height < $subReportHeight) {
         $requestedHeight = $subReportHeight;
     }
     $this->Height = $requestedHeight;
     $this->_exporter->printNormal($this, $this->_subReport->subReportBuff);
     // Reset control height
     $this->Height = $originalHeight;
     return $this->stdHeight($requestedHeight);
 }