示例#1
0
 /**
  * List all Cache types
  *
  * @return  MageHack_MageConsole_Model_Abstract
  */
 public function listing()
 {
     $collection = new Varien_Data_Collection();
     foreach (Mage::app()->getCacheInstance()->getTypes() as $type) {
         $collection->addItem($type);
     }
     if (!$collection->count()) {
         $message = 'This is strange, we did not find any cache types.';
         $this->setType(self::RESPONSE_TYPE_MESSAGE);
         $this->setMessage($message);
     } else {
         if ($collection->count() > 0) {
             $values = $collection->toArray();
             if (is_array($values) && $values['totalRecords'] > 0) {
                 foreach ($values['items'] as $row) {
                     if (is_array($row)) {
                         $_values[] = array_intersect_key($row, $this->_attrToShow);
                     }
                 }
                 if (Mage::getStoreConfig('admin/mageconsole/html_tables') != 1) {
                     $this->setType(self::RESPONSE_TYPE_MESSAGE);
                     $message = Mage::helper('mageconsole')->createTable($_values, true, $this->_columnWidths);
                     $this->setMessage($message);
                 } else {
                     $this->setMessage($_values);
                     $this->setType(self::RESPONSE_TYPE_LIST);
                 }
             }
         }
     }
     return $this;
 }