public function indexateAction() { if ($ids = $this->getRequest()->getParam('ids')) { $data = $this->z_model->fetchAll(array('id in (?)' => $ids)); } else { $data = $this->z_model->fetchAll(); } foreach ($data as $el) { $this->addToIndex($el->toArray()); } $this->ajaxGo($this->view->url(array('action' => $this->z_defaultAction))); $this->disableRenderView(); }
/** * @return string */ public function getUninstalled() { try { if (!$this->_url) { return null; } $http = new Zend_Http_Client($this->_url); $response = $http->request(); $items = array(); if ($response->isSuccessful()) { $res = $response->getBody(); $array = @unserialize($res); if ($array && is_array($array) && count($array)) { //var_dump($array); $files = array_keys($array); $filter_data = trim(implode(',', $files)); $filter_data = trim(preg_replace('/\\,\\z|\\A\\,/', '', $filter_data)); if ($filter_data) { //var_dump($files); $filter['uid IN(?)'] = $files; $rows = $this->_model->fetchAll($filter); $result = explode(',', $filter_data); if (count($rows)) { foreach ($rows as $row) { $found = array_search($row->uid, $result); if ($found !== false) { if (isset($array[$result[$found]])) { unset($array[$result[$found]]); } } } } } function cmp($a, $b) { $date = $dateA = $dateB = null; preg_match('#([0-9]{1,2})_([0-9]{1,2})_([0-9]{4}).*#i', $a, $date); $date_str = ''; if (count($date)) { $date_part = @array_slice($date, 1, 3); if (count($date_part)) { $date_str = implode('.', $date_part); $dateA = new Zend_Date($date_str); } } $date = null; preg_match('#([0-9]{1,2})_([0-9]{1,2})_([0-9]{4}).*#i', $b, $date); $date_str = ''; if (count($date)) { $date_part = @array_slice($date, 1, 3); if (count($date_part)) { $date_str = implode('.', $date_part); $dateB = new Zend_Date($date_str); } } if ($dateA && $dateB) { if ($dateA->equals($dateB, Zend_Date::DATES)) { return 0; } if ($dateA->isEarlier($dateB, Zend_Date::DATES)) { return -1; } if ($dateA->isLater($dateB, Zend_Date::DATES)) { return 1; } } else { if ($a == $b) { return 0; } return $a < $b ? -1 : 1; } } uksort($array, "cmp"); //var_dump($array); /* var_dump($array); ksort($array); var_dump($array); */ return $array; } } } catch (Zend_Http_Client_Exception $e) { Zend_Debug::dump($e->getMessage()); return null; } return null; }