示例#1
0
 /**
  *
  * @return type 
  */
 public function getConfig()
 {
     if (FALSE == ($config = App_Cache::load($this->_idCache))) {
         $config = $this->getCurrentConfig();
         App_Cache::save($config, $this->_idCache);
     }
     return $config;
 }
示例#2
0
 /**
  * (non-PHPdoc)
  * @see Zend_Db_Table_Abstract::fetchAll()
  */
 public function fetchAll($where = null, $order = null, $count = null, $offset = null)
 {
     if (empty($where)) {
         $tableName = $this->getTableName();
         if (false == ($rows = App_Cache::load($tableName))) {
             $rows = parent::fetchAll($where, $order, $count, $offset);
             App_Cache::save($rows, $tableName);
         }
     } else {
         $rows = parent::fetchAll($where, $order, $count, $offset);
     }
     $rows = parent::fetchAll($where, $order, $count, $offset);
     return $rows;
 }
示例#3
0
 /**
  *
  * @return boolean 
  */
 public function fixPhones()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $tables = array('PerData' => array('client_fone'));
         $now = App_Cache::load('current_fix_phone');
         if (empty($now)) {
             $now = 0;
         }
         $fixed = 0;
         $step = 2000;
         echo 'Step: ' . $step . ' - now: ' . $now . "\n\r";
         foreach ($tables as $table => $fields) {
             $db = App_Model_DbTable_Factory::get($table);
             $rows = $db->fetchAll(array(), array(), $step, $now);
             foreach ($rows as $row) {
                 $altered = false;
                 foreach ($fields as $field) {
                     $newPhone = App_General_String::cleanFone($row[$field]);
                     if (!empty($newPhone)) {
                         $row[$field] = $newPhone;
                         $altered = true;
                     }
                 }
                 if ($altered) {
                     $row->save();
                     $fixed++;
                 }
             }
         }
         $now += $step;
         App_Cache::save($now, 'current_fix_phone');
         $dbAdapter->commit();
         echo number_format($fixed, 0, '', '.') . ' Phones fixed' . "\n\r";
         echo str_repeat('-', 30) . "\n\r";
         return true;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         echo 'Error fixing phones: ' . $e->getMessage() . "\n\r";
         return false;
     }
 }
示例#4
0
 /**
  * 
  */
 public function imageAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->_getParam('id');
     $dataReport = $this->_session->dataReport;
     if (!empty($dataReport)) {
         $imageData = $dataReport['graph'][$id];
         App_Cache::save($imageData, $id);
     } else {
         $imageData = App_Cache::load($id);
     }
     $resource = imagecreatefromstring($imageData);
     header('Content-type: image/png');
     imagepng($resource);
 }