Changeset 10322
- Timestamp:
- Jan 22, 2009, 10:57:14 PM (12 years ago)
- Location:
- OpenPNE3/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE3/trunk/apps/pc_backend/modules/design/actions/actions.class.php
r10315 r10322 71 71 $this->gadgets = array( 72 72 'top' => GadgetPeer::retrieveTopGadgets(), 73 'sideMenu' 73 'sideMenu' => GadgetPeer::retrieveSideMenuGadgets(), 74 74 'contents' => GadgetPeer::retrieveContentsGadgets(), 75 'bottom' => GadgetPeer::retrieveBottomGadgets(),75 'bottom' => GadgetPeer::retrieveBottomGadgets(), 76 76 ); 77 77 } … … 122 122 public function executeAddGadget(sfWebRequest $request) 123 123 { 124 $validTypes = array('top', 'sideMenu', 'contents', 'bottom', 'mobileTop', 'mobileContents', 'mobileBottom', 'sideBannerContents'); 125 $mobileTypes = array('mobileTop', 'mobileContents', 'mobileBottom'); 126 $sideBannerTypes = array('sideBannerContents'); 127 128 $this->config = sfConfig::get('op_gadget_list', array()); 129 $this->type = 'top'; 130 if (in_array($request->getParameter('type'), $validTypes)) 131 { 132 $this->type = $request->getParameter('type'); 133 } 134 135 if (in_array($this->type, $mobileTypes)) 136 { 137 $this->config = sfConfig::get('op_mobile_gadget_list', array()); 138 } 139 elseif (in_array($this->type, $sideBannerTypes)) 140 { 141 $this->config = sfConfig::get('op_side_banner_gadget_list', array()); 142 } 124 $this->type = $request->getParameter('type','top'); 125 $this->config = GadgetPeer::getGadgetConfigListByType($this->type); 143 126 144 127 return sfView::SUCCESS; … … 154 137 $this->gadget = GadgetPeer::retrieveByPK($request->getParameter('id')); 155 138 156 $mobileTypes = array('mobileTop', 'mobileContents', 'mobileBottom');157 $sideBannerTypes = array('sideBannerContents');158 159 139 $type = $this->gadget->getType(); 160 $config = sfConfig::get('op_gadget_list', array()); 161 162 if (in_array($type, $mobileTypes)) 163 { 164 $config = sfConfig::get('op_mobile_gadget_list', array()); 165 } 166 elseif (in_array($type, $sideBannerTypes)) 167 { 168 $config = sfConfig::get('op_side_banner_gadget_list', array()); 169 } 140 $config = GadgetPeer::getGadgetConfigListByType($type); 170 141 171 142 $this->forward404Unless($this->gadget && $config); -
OpenPNE3/trunk/lib/model/Gadget.php
r10315 r10322 11 11 class Gadget extends BaseGadget 12 12 { 13 protected function getConfigList()14 {15 $mobileTypes = array('mobileTop', 'mobileContents', 'mobileBottom');16 $sideBannerTypes = array('sideBannerContents');17 if (in_array($this->getType(), $mobileTypes))18 {19 $list = sfConfig::get('op_mobile_gadget_list');20 }21 elseif(in_array($this->getType(), $sideBannerTypes))22 {23 return sfConfig::get('op_side_banner_gadget_list');24 }25 return sfConfig::get('op_gadget_list');26 }27 28 13 public function save(PropelPDO $con = null) 29 14 { … … 47 32 public function getComponentModule() 48 33 { 49 $list = $this->getConfigList();34 $list = GadgetPeer::getGadgetConfigListByType($this->getType()); 50 35 51 36 if (empty($list[$this->getName()])) … … 59 44 public function getComponentAction() 60 45 { 61 $list = $this->getConfigList();46 $list = GadgetPeer::getGadgetConfigListByType($this->getType()); 62 47 63 48 if (empty($list[$this->getName()])) … … 71 56 public function isEnabled() 72 57 { 73 $list = $this->getConfigList();58 $list = GadgetPeer::getGadgetConfigListByType($this->getType()); 74 59 if (empty($list[$this->getName()])) 75 60 { … … 83 68 { 84 69 $result = null; 85 $list = $this->getConfigList();70 $list = GadgetPeer::getGadgetConfigListByType($this->getType()); 86 71 87 72 $config = GadgetConfigPeer::retrieveByGadgetIdAndName($this->getId(), $name); -
OpenPNE3/trunk/lib/model/GadgetPeer.php
r10260 r10322 11 11 class GadgetPeer extends BaseGadgetPeer 12 12 { 13 static protected $pcTypes = array('top', 'sideMenu', 'contents', 'bottom'); 14 15 static protected $mobileTypes = array('mobileTop', 'mobileContents', 'mobileBottom'); 16 17 static protected $sideBannerTypes = array('sideBannerContents'); 18 13 19 static protected $results; 14 20 … … 109 115 return self::$results; 110 116 } 117 118 static public function getGadgetConfigListByType($type) 119 { 120 if (in_array($type, self::$pcTypes)) 121 { 122 return sfConfig::get('op_gadget_list', array()); 123 } 124 elseif (in_array($type, self::$mobileTypes)) 125 { 126 return sfConfig::get('op_mobile_gadget_list', array()); 127 } 128 elseif (in_array($type, self::$sideBannerTypes)) 129 { 130 return sfConfig::get('op_side_banner_gadget_list', array()); 131 } 132 return array(); 133 } 111 134 }
Note: See TracChangeset
for help on using the changeset viewer.