Exemple #1
0
 /**
  * Displays a url in a lightbox
  *
  * @param $url
  * @param $text
  * @param array options(
  * 				'width',
  *				'height',
  * 				'top',
  * 				'left',
  * 				'class',
  * 				'update',
  * 				'img'
  * 				)
  * @return popup html
  */
 public static function popup($url, $text, $options = array())
 {
     $html = "";
     if (!empty($options['update'])) {
         JHTML::_('behavior.modal', 'a.modal', array('onClose' => '\\function(){Dsc.update();}'));
     } else {
         JHTML::_('behavior.modal');
     }
     // set the $handler_string based on the user's browser
     $handler_string = "{handler:'iframe',size:{x: window.innerWidth-80, y: window.innerHeight-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}";
     $browser = DSC::getClass('DSCBrowser', 'library.browser');
     if ($browser->getBrowser() == DSCBrowser::BROWSER_IE) {
         // if IE, use
         $handler_string = "{handler:'iframe',size:{x:window.getSize().scrollSize.x-80, y: window.getSize().size.y-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}";
     }
     $handler = !empty($options['img']) ? "{handler:'image'}" : $handler_string;
     if (!empty($options['width'])) {
         if (empty($options['height'])) {
             $options['height'] = 480;
         }
         $handler = "{handler: 'iframe', size: {x: " . $options['width'] . ", y: " . $options['height'] . "}}";
     }
     $id = !empty($options['id']) ? $options['id'] : '';
     $class = !empty($options['class']) ? $options['class'] : '';
     $linkclass = !empty($options['linkclass']) ? $options['linkclass'] : '';
     $linkclass = $linkclass . ' modal';
     $html = "<a class=\"" . $linkclass . "\" href=\"{$url}\" rel=\"{$handler}\" >\n";
     $html .= "<span class=\"" . $class . "\" id=\"" . $id . "\" >\n";
     $html .= "{$text}\n";
     $html .= "</span>\n";
     $html .= "</a>\n";
     return $html;
 }
Exemple #2
0
 /**
  * Returns an array of user objects
  * of all users who should receive this email
  *
  * @param $data Object
  * @return array
  */
 private function getEmailRecipients($id, $type = 'order')
 {
     $recipients = array();
     switch ($type) {
         case "new_order":
             $system_recipients = $this->getSystemEmailRecipients();
             foreach ($system_recipients as $r) {
                 if (!in_array($r->email, $recipients)) {
                     $recipients[] = $r->email;
                 }
             }
         case 'order':
         default:
             $model = DSC::getClass('DSCModelOrders', 'models.orders');
             $model->setId($id);
             $order = $model->getItem();
             $user = JFactory::getUser($order->user_id);
             //$user = JUser::getInstance( $order->user_id );
             // is the email one of our guest emails?
             $pos = strpos($user->email, "guest");
             if ($pos === false) {
                 // string needle NOT found in haystack
                 if (!in_array($user->email, $recipients)) {
                     $recipients[] = $user->email;
                 }
             } else {
                 // add the userinfo email to the list of recipients
                 if (!in_array($order->userinfo_email, $recipients)) {
                     $recipients[] = $order->userinfo_email;
                 }
             }
             // add the order user_email to the list of recipients
             if (!in_array($order->user_email, $recipients)) {
                 $recipients[] = $order->user_email;
             }
             break;
     }
     // allow plugins to modify the order email recipient list
     JFactory::getApplication()->triggerEvent('onGetEmailRecipients', array($id, $type, &$recipients));
     return $recipients;
 }
Exemple #3
0
 public static function popup($url, $text, $options = array())
 {
     if (!empty($options['bootstrap'])) {
         return self::popupbootstrap($url, $text, $options);
     }
     $html = "";
     JHTML::_('stylesheet', 'colorbox.css', 'media/com_tienda/colorbox/');
     JHTML::_('script', 'colorbox.js', 'media/com_tienda/colorbox/');
     $document = JFactory::getDocument();
     $js = "tiendaJQ(document).ready(function() { tiendaJQ('.tienda-modal').colorbox({current: '', iframe: true, opacity: '0.6', width: '80%', height: '80%'}); });";
     $document->addScriptDeclaration($js);
     if (!empty($options['update'])) {
         $onclose = 'onClose: function(){ Dsc.update(); },';
     } else {
         $onclose = '';
     }
     // set the $handler_string based on the user's browser
     $handler_string = "{handler:'iframe', " . $onclose . " size:{x: window.innerWidth-80, y: window.innerHeight-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}";
     $browser = DSC::getClass('DSCBrowser', 'library.browser');
     if ($browser->getBrowser() == DSCBrowser::BROWSER_IE) {
         // if IE, use
         $handler_string = "{handler:'iframe', " . $onclose . " size:{x:window.getSize().scrollSize.x-80, y: window.getSize().size.y-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}";
     }
     $handler = !empty($options['img']) ? "{handler:'image'}" : $handler_string;
     if (!empty($options['width'])) {
         if (empty($options['height'])) {
             $options['height'] = 480;
         }
         $handler = "{handler: 'iframe', " . $onclose . " size: {x: " . $options['width'] . ", y: " . $options['height'] . "}}";
     }
     $id = !empty($options['id']) ? $options['id'] : '';
     $class = !empty($options['class']) ? $options['class'] : '';
     $html = "<a class=\"tienda-modal\" href=\"{$url}\" rel=\"{$handler}\" >\n";
     $html .= "<span class=\"" . $class . "\" id=\"" . $id . "\" >\n";
     $html .= "{$text}\n";
     $html .= "</span>\n";
     $html .= "</a>\n";
     return $html;
 }
Exemple #4
0
 public static function popupImage($url, $text, $options = array())
 {
     if (!empty($options['bootstrap'])) {
         return self::popupbootstrap($url, $text, $options);
     }
     $html = "";
     $doc = JFactory::getDocument();
     $doc->addStyleSheet(JUri::root() . 'media/citruscart/colorbox/colorbox.css');
     $doc->addScript(JUri::root() . 'media/citruscart/colorbox/colorbox.js');
     $document = JFactory::getDocument();
     $js = "citruscartJQ(document).ready(function() { citruscartJQ('.citruscart-modal').colorbox({current: '', iframe: true, opacity: '0.6', width: '80%', height: '80%'}); });";
     $document->addScriptDeclaration($js);
     if (!empty($options['update'])) {
         $onclose = 'onClose: function(){ Dsc.update(); },';
     } else {
         $onclose = '';
     }
     // set the $handler_string based on the user's browser
     $handler_string = "{handler:'iframe', " . $onclose . " size:{x: window.innerWidth-80, y: window.innerHeight-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}";
     require_once JPATH_SITE . '/libraries/dioscouri/dioscouri.php';
     $browser = DSC::getClass('DSCBrowser', 'library.browser');
     if ($browser->getBrowser() == DSCBrowser::BROWSER_IE) {
         // if IE, use
         $handler_string = "{handler:'iframe', " . $onclose . " size:{x:window.getSize().scrollSize.x-80, y: window.getSize().size.y-80}, onShow:\$('sbox-window').setStyles({'padding': 0})}";
     }
     $handler = !empty($options['img']) ? "{handler:'image'}" : $handler_string;
     if (!empty($options['width'])) {
         if (empty($options['height'])) {
             $options['height'] = 480;
         }
         $handler = "{handler: 'iframe', " . $onclose . " size: {x: " . $options['width'] . ", y: " . $options['height'] . "}}";
     }
     $id = "main_image";
     $class = "zoom";
     $html = "<a>\n";
     $html .= "<span class=\"" . $class . "\" id=\"" . $id . "\" >\n";
     $html .= "{$text}\n";
     $html .= "</span>\n";
     $html .= "</a>\n";
     return $html;
 }
Exemple #5
0
 /**
  * Intelligently loads instances of classes in framework
  *
  * Usage: $object = Mysite::getClass( 'MysiteHelperCarts', 'helpers.carts' );
  * Usage: $suffix = Mysite::getClass( 'MysiteHelperCarts', 'helpers.carts' )->getSuffix();
  * Usage: $categories = Mysite::getClass( 'MysiteSelect', 'select' )->category( $selected );
  *
  * @param string $classname   The class name
  * @param string $filepath    The filepath ( dot notation )
  * @param array  $options
  * @return object of requested class (if possible), else a new JObject
  */
 public static function getClass($classname, $filepath = 'controller', $options = array('site' => 'admin', 'type' => 'components', 'ext' => 'com_mysite'))
 {
     return parent::getClass($classname, $filepath, $options);
 }