00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Depends
00035 extends Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Abstract
00036 {
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setTemplate('extensions/local/depends.phtml');
00041 }
00042
00043 public function getDepends()
00044 {
00045 foreach ($this->getPkg()->getDependencies() as $role=>$types) {
00046 if (!('required'===$role || 'optional'===$role)) {
00047 continue;
00048 }
00049 foreach ($types as $type=>$depends) {
00050 if (!('php'===$type || 'package'===$type || 'extension'===$type)) {
00051 continue;
00052 }
00053 if (isset($depends[0])) {
00054 foreach ($depends as $dep) {
00055 $this->_addDep($deps, $role, $type, $dep);
00056 }
00057 } else {
00058 if ('php'===$type) {
00059 $depends['name'] = 'PHP';
00060 }
00061 $this->_addDep($deps, $role, $type, $depends);
00062 }
00063 }
00064 }
00065
00066 return $deps;
00067 }
00068
00069 protected function _addDep(&$deps, $role, $type, $dep)
00070 {
00071 $deps[] = array(
00072 'type'=>$type,
00073 'role'=>isset($dep['conflicts']) ? 'conflicts' : $role,
00074 'name'=>$dep['name'],
00075 'channel'=>isset($dep['channel']) ? $dep['channel'] : null,
00076 'min'=>isset($dep['min']) ? $dep['min'] : null,
00077 'max'=>isset($dep['max']) ? $dep['max'] : null,
00078 'recommended'=>isset($dep['recommended']) ? $dep['recommended'] : null,
00079 'exclude'=>isset($dep['exclude']) ? print_r($dep['exclude'], 1) : null,
00080 );
00081 }
00082
00083 public function getGroups()
00084 {
00085 $groups = array();
00086 foreach ($this->getData('pkg/dependencies/groups') as $group) {
00087 $groups[] = array(
00088 'name'=>$group['name'],
00089 'hint'=>$group['hint'],
00090 );
00091 }
00092 return $groups;
00093 }
00094 }