コード例 #1
0
 /**
  * We register the search form on the page controller here.
  * 
  * @param string $widget Not documented in parent class unfortunately
  * 
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 20.03.2014
  */
 public function __construct($widget = null)
 {
     parent::__construct($widget);
     if ($this->widget instanceof Widget && $this->widget->exists()) {
         if (Controller::curr()->getRegisteredCustomHtmlForm('SilvercartLoginWidgetForm' . $this->widget->ID) === false) {
             Controller::curr()->registerCustomHtmlForm('SilvercartLoginWidgetForm' . $this->widget->ID, new SilvercartLoginWidgetForm(Controller::curr(), array('redirect_to' => $_SERVER['REQUEST_URI'])));
         }
     }
 }
コード例 #2
0
 /**
  * Creates the cache key for this widget.
  * 
  * @param SilvercartWidget_Controller $widget Widget to get cache key for
  *
  * @return string
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 15.11.2014
  */
 public static function ProductWidgetCacheKey($widget)
 {
     $key = '';
     if ($widget->Elements() instanceof SS_List && $widget->Elements()->exists()) {
         $map = $widget->Elements()->map('ID', 'LastEditedForCache');
         if ($map instanceof SS_Map) {
             $productMap = $map->toArray();
         } else {
             $productMap = $map;
         }
         if (!is_array($productMap)) {
             $productMap = array();
         }
         if ($widget->Elements()->exists() && (empty($productMap) || count($productMap) == 1 && array_key_exists('', $productMap))) {
             $productMap = array();
             foreach ($widget->Elements() as $page) {
                 $map = $page->Elements->map('ID', 'LastEditedForCache');
                 if ($map instanceof SS_Map) {
                     $productMapToAdd = $map->toArray();
                 } else {
                     $productMapToAdd = $map;
                 }
                 $productMap = array_merge($productMap, $productMapToAdd);
             }
         }
         $productMapIDs = implode('_', array_keys($productMap));
         sort($productMap);
         $productMapLastEdited = array_pop($productMap);
         $groupIDs = '';
         if (Member::currentUserID() > 0) {
             $groupIDs = implode('-', SilvercartCustomer::currentUser()->getGroupIDs());
         }
         $keyParts = array(i18n::get_locale(), $productMapIDs, $productMapLastEdited, $widget->LastEdited, $groupIDs);
         $key = implode('_', $keyParts);
     }
     return $key;
 }
コード例 #3
0
 /**
  * We register the search form on the page controller here.
  * 
  * @param string $widget Not documented in parent class unfortunately
  * 
  * @author Sascha Koehler <*****@*****.**>
  * @since 26.05.2011
  */
 public function __construct($widget = null)
 {
     parent::__construct($widget);
     Controller::curr()->registerCustomHtmlForm('SilvercartSearchWidgetForm' . $this->classInstanceIdx, new SilvercartSearchWidgetForm(Controller::curr()));
 }