Ejemplo n.º 1
0
 /**
  * Display the view.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $section = $this->state->get('category.section') ? $this->state->get('category.section') . '.' : '';
     $this->canDo = JHelperContent::getActions($this->state->get('category.component'), $section . 'category', $this->item->id);
     $this->assoc = $this->get('Assoc');
     $input = JFactory::getApplication()->input;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Check for tag type
     $this->checkTags = JHelperTags::getTypes('objectList', array($this->state->get('category.extension') . '.category'), true);
     $input->set('hidemainmenu', true);
     if ($this->getLayout() == 'modal') {
         $this->form->setFieldAttribute('language', 'readonly', 'true');
         $this->form->setFieldAttribute('parent_id', 'readonly', 'true');
     }
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('categories');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 function display($tpl = null)
 {
     //$comInfo = JComponentHelper::getComponent('com_digicom');
     //print_r ( $comInfo->params );die;
     $form = null;
     $component = null;
     try {
         $form = $this->get('Form');
         $component = $this->get('Component');
         $user = JFactory::getUser();
     } catch (Exception $e) {
         JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
         return false;
     }
     // Bind the form to the data.
     if ($form && $component->params) {
         $form->bind($component->params);
     }
     $this->form =& $form;
     $this->component =& $component;
     $this->userIsSuperAdmin = $user->authorise('core.admin');
     $this->currentComponent = JFactory::getApplication()->input->get('component');
     $this->return = JFactory::getApplication()->input->get('return', '', 'base64');
     JFactory::getApplication()->input->set('hidemainmenu', true);
     //set toolber
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('configs');
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Ejemplo n.º 3
0
 function display($tpl = null)
 {
     //require_once( JPATH_COMPONENT.DS.'helpers'.DS.'sajax.php' );
     $db = JFactory::getDBO();
     $customer = $this->get('customer');
     //print_r($customer);die;
     $user = $this->get('User');
     $isNew = $customer->id < 1;
     $text = $isNew ? JText::_('COM_DIGICOM_NEW') : JText::_('COM_DIGICOM_EDIT') . " : " . $customer->firstname;
     JToolBarHelper::title(JText::_('COM_DIGICOM_CUSTOMER') . ":<small>[" . $text . "]</small>");
     $bar = JToolBar::getInstance('toolbar');
     $layout = new JLayoutFile('toolbar.title');
     $title = array('title' => JText::_('COM_DIGICOM_CUSTOMER') . ":<small>[" . $text . "]</small>", 'class' => 'title');
     $bar->appendButton('Custom', $layout->render($title), 'title');
     $layout = new JLayoutFile('toolbar.settings');
     $bar->appendButton('Custom', $layout->render(array()), 'settings');
     JToolBarHelper::apply('customer.apply');
     JToolBarHelper::save('customer.save');
     JToolBarHelper::divider();
     JToolBarHelper::cancel('customer.cancel');
     $this->assign("cust", $customer);
     $this->assign("user", $user);
     $configs = $this->get("Configs");
     $this->assign("configs", $configs);
     DigiComHelperDigiCom::addSubmenu('customers');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 4
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->assoc = $this->get('Assoc');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Preprocess the list of items to find ordering divisions.
     foreach ($this->items as &$item) {
         $this->ordering[$item->parent_id][] = $item->id;
     }
     // Levels filter.
     $options = array();
     $options[] = JHtml::_('select.option', '1', JText::_('J1'));
     $options[] = JHtml::_('select.option', '2', JText::_('J2'));
     $options[] = JHtml::_('select.option', '3', JText::_('J3'));
     $options[] = JHtml::_('select.option', '4', JText::_('J4'));
     $options[] = JHtml::_('select.option', '5', JText::_('J5'));
     $options[] = JHtml::_('select.option', '6', JText::_('J6'));
     $options[] = JHtml::_('select.option', '7', JText::_('J7'));
     $options[] = JHtml::_('select.option', '8', JText::_('J8'));
     $options[] = JHtml::_('select.option', '9', JText::_('J9'));
     $options[] = JHtml::_('select.option', '10', JText::_('J10'));
     $this->f_levels = $options;
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('categories');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 5
0
 /**
  * Method to display a view.
  *
  * @param   boolean  $cachable   If true, the view output will be cached
  * @param   array    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return  JControllerLegacy  This object to support chaining.
  *
  * @since   1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     DigiComHelperDigiCom::addAdminStyles();
     $view = $this->input->get('view', 'digicom');
     $layout = $this->input->get('layout', 'default');
     return parent::display();
 }
Ejemplo n.º 6
0
 function display($tpl = null)
 {
     // Access check.
     if (!JFactory::getUser()->authorise('digicom.orders', 'com_digicom')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $document = JFactory::getDocument();
     $orders = $this->get('Items');
     $pagination = $this->get('Pagination');
     $this->orders = $orders;
     $this->pagination = $pagination;
     $startdate = JRequest::getVar("startdate", "", "request");
     $startdate = strtotime($startdate);
     //$startdate = DigiComHelperDigiCom::parseDate( $configs->get('time_format','DD-MM-YYYY'), $startdate );
     $this->assign("startdate", $startdate);
     $enddate = JRequest::getVar("enddate", "", "request");
     $enddate = strtotime($enddate);
     //$enddate = DigiComHelperDigiCom::parseDate( $configs->get('time_format','DD-MM-YYYY'), $enddate );
     $this->assign("enddate", $enddate);
     $keyword = JRequest::getVar("keyword", "", "request");
     $this->assign("keyword", $keyword);
     //set toolber
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('orders');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 7
0
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_DIGICOM_ABOUT_TOOLBAR_TITLE'), 'generic.png');
     $bar = JToolBar::getInstance('toolbar');
     // Instantiate a new JLayoutFile instance and render the layout
     $layout = new JLayoutFile('toolbar.title');
     $title = array('title' => JText::_('COM_DIGICOM_ABOUT_TOOLBAR_TITLE'), 'class' => 'title');
     $bar->appendButton('Custom', $layout->render($title), 'title');
     $layout = new JLayoutFile('toolbar.settings');
     $bar->appendButton('Custom', $layout->render(array()), 'settings');
     DigiComHelperDigiCom::addSubmenu('about');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 8
0
 /**
  * Display the view
  *
  * @return  void
  */
 function display($tpl = null)
 {
     $this->latest_orders = DigiComHelperDigiCom::getOrders(5);
     $this->most_sold = DigiComHelperDigiCom::getMostSoldProducts(5);
     $this->totalOrder = $this->get('reportTotal');
     $this->reportOrders = $this->get('reportOrders');
     $this->reportCustomer = $this->get('reportCustomer');
     $this->configs = $this->get('configs');
     //load the toolber
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('digicom');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 9
0
 function display($tpl = null)
 {
     // Access check.
     if (!JFactory::getUser()->authorise('digicom.reports', 'com_digicom')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $this->latest_orders = DigiComHelperDigiCom::getOrders(5);
     $this->most_sold = DigiComHelperDigiCom::getMostSoldProducts(5);
     $this->totalOrder = $this->get('reportTotal');
     $this->reportOrders = $this->get('reportOrders');
     $this->reportCustomer = $this->get('reportCustomer');
     $this->configs = $this->get('configs');
     //load the toolber
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('reports');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 10
0
 function display($tpl = null)
 {
     // Access check.
     if (!JFactory::getUser()->authorise('digicom.discounts', 'com_digicom')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $condition = JRequest::getVar("condition", '1');
     $this->assign("condition", $condition);
     $status = JRequest::getVar("status", '');
     $this->assign("status", $status);
     $this->promos = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->configs = $this->get('configs');
     //set toolber
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('discounts');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 11
0
 function display($tpl = null)
 {
     if ($this->getLayout() !== 'modal') {
         DigiComHelperDigiCom::addSubmenu('products');
     }
     // Access check.
     if (!JFactory::getUser()->authorise('digicom.products', 'com_digicom')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->authors = $this->get('Authors');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     $this->configs = $this->get('configs');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Levels filter.
     $options = array();
     $options[] = JHtml::_('select.option', '1', JText::_('J1'));
     $options[] = JHtml::_('select.option', '2', JText::_('J2'));
     $options[] = JHtml::_('select.option', '3', JText::_('J3'));
     $options[] = JHtml::_('select.option', '4', JText::_('J4'));
     $options[] = JHtml::_('select.option', '5', JText::_('J5'));
     $options[] = JHtml::_('select.option', '6', JText::_('J6'));
     $options[] = JHtml::_('select.option', '7', JText::_('J7'));
     $options[] = JHtml::_('select.option', '8', JText::_('J8'));
     $options[] = JHtml::_('select.option', '9', JText::_('J9'));
     $options[] = JHtml::_('select.option', '10', JText::_('J10'));
     $this->f_levels = $options;
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         //set toolber
         $this->addToolbar();
         $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     }
     parent::display($tpl);
 }
Ejemplo n.º 12
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     $this->configs = $this->get('configs');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         //set toolber
         DigiComHelperDigiCom::addSubmenu('products');
         $this->addToolbar();
         $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     }
     parent::display($tpl);
 }
Ejemplo n.º 13
0
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     $this->configs = $this->get('configs');
     $this->promocode = $this->get('promocode');
     JToolBarHelper::title(JText::_('COM_DIGICOM_ORDER_CREATE_NEW_ORDER_TOOLBAR_TITLE'), 'generic.png');
     $bar = JToolBar::getInstance('toolbar');
     // Instantiate a new JLayoutFile instance and render the layout
     $layout = new JLayoutFile('toolbar.title');
     $title = array('title' => JText::_('COM_DIGICOM_ORDER_CREATE_NEW_ORDER_TOOLBAR_TITLE'), 'class' => 'title');
     $bar->appendButton('Custom', $layout->render($title), 'title');
     $layout = new JLayoutFile('toolbar.settings');
     $bar->appendButton('Custom', $layout->render(array()), 'settings');
     JToolBarHelper::save('ordernew.save');
     JToolBarHelper::cancel('order.cancel');
     DigiComHelperDigiCom::addSubmenu('orders');
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Ejemplo n.º 14
0
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_DIGICOM_FILE_MANAGER_TOOLBAR_TITLE'), 'generic.png');
     // Access check.
     if (!JFactory::getUser()->authorise('digicom.filemanager', 'com_digicom')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $bar = JToolBar::getInstance('toolbar');
     // Instantiate a new JLayoutFile instance and render the layout
     $layout = new JLayoutFile('toolbar.title');
     $title = array('title' => JText::_('COM_DIGICOM_FILE_MANAGER_TOOLBAR_TITLE'), 'class' => 'title');
     $bar->appendButton('Custom', $layout->render($title), 'title');
     $layout = new JLayoutFile('toolbar.settings');
     $bar->appendButton('Custom', $layout->render(array()), 'settings');
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/media/digicom/assets/css/smoothness/jquery-ui.css?v=1.8.0');
     $document->addStyleSheet(JURI::root(true) . '/media/digicom/assets/css/theme.css?v=2.7.0');
     $document->addStyleSheet(JURI::root(true) . '/media/digicom/assets/css/elfinder.min.css?v=2.7.0');
     if ($document->getType() == 'html') {
         $document->addScript(JURI::root(true) . '/media/digicom/assets/js/jquery-ui-1.8.24.custom.min.js');
         $document->addScript(JURI::root(true) . '/media/digicom/assets/js/elfinder.js?v=1.0.0');
     }
     $type = JRequest::getCmd('type');
     $fieldID = JRequest::getCmd('fieldID');
     $mimes = '';
     $this->assignRef('mimes', $mimes);
     $this->assignRef('type', $type);
     $this->assignRef('fieldID', $fieldID);
     $tmpl = JRequest::getCmd('tmpl', '');
     if ($tmpl != 'component') {
         DigiComHelperDigiCom::addSubmenu('filemanager');
         $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     }
     parent::display($tpl);
 }
Ejemplo n.º 15
0
 function display($tpl = null)
 {
     // Access check.
     if (!JFactory::getUser()->authorise('digicom.customers', 'com_digicom')) {
         return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     $layout = JRequest::getVar('layout', '');
     if ($layout) {
         $this->setLayout($layout);
     }
     $customers = $this->get('Items');
     $pagination = $this->get('Pagination');
     $this->custs = $customers;
     $this->pagination = $pagination;
     $prd = JRequest::getVar("prd", 0, "request");
     $this->assign("prd", $prd);
     $keyword = JRequest::getVar("keyword", "", "request");
     $this->assign("keyword", $keyword);
     //set toolber
     $this->addToolbar();
     DigiComHelperDigiCom::addSubmenu('customers');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 16
0
        ?>
										</td>
										<td align="center">
											<?php 
        echo DigiComHelperDigiCom::format_price($order->amount, $configs->get('currency', 'USD'), true, $configs);
        ?>
										</td>
										<td align="center">
											<?php 
        if ($order->amount_paid == "-1") {
            $order->amount_paid = $order->amount;
        }
        $refunds = DigiComHelperDigiCom::getRefunds($order->id);
        $chargebacks = DigiComHelperDigiCom::getChargebacks($order->id);
        $order->amount_paid = $order->amount_paid - $refunds - $chargebacks;
        echo DigiComHelperDigiCom::format_price($order->amount_paid, $configs->get('currency', 'USD'), true, $configs);
        ?>
										</td>
										<td align="center">
											<?php 
        $a_style = "";
        if ($order->status == "Pending") {
            $a_style = ' label-warning';
        } else {
            $a_style = ' label-success';
        }
        ?>
											<span class="label<?php 
        echo $a_style;
        ?>
"><?php 
Ejemplo n.º 17
0
 function editForm($tpl = null)
 {
     $db = JFactory::getDBO();
     $order = $this->get('order');
     $isNew = $order->id < 1;
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     JToolBarHelper::title(JText::_('Order') . ":<small>[" . $text . "]</small>");
     $bar = JToolBar::getInstance('toolbar');
     $layout = new JLayoutFile('toolbar.title');
     $title = array('title' => JText::_('Order') . ":<small>[" . $text . "]</small>", 'class' => 'title');
     $bar->appendButton('Custom', $layout->render($title), 'title');
     $layout = new JLayoutFile('toolbar.settings');
     $bar->appendButton('Custom', $layout->render(array()), 'settings');
     //		JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', 'Close');
     }
     $this->assign("order", $order);
     //dsdebug($order);
     $configs = $this->_models['config']->getConfigs();
     $lists = array();
     $prods = $this->_models['product']->getListProducts();
     $opts = array();
     $opts[] = JHTML::_('select.option', "", JText::_("Select product"));
     foreach ($prods as $prod) {
         $opts[] = JHTML::_('select.option', $prod->id, $prod->name);
     }
     $lists['productid'] = JHTML::_('select.genericlist', $opts, 'productid', 'class="inputbox" size="1" ', 'value', 'text', '');
     // $license->productid
     $this->assign("configs", $configs);
     $this->assign("lists", $lists);
     $this->assign("currency_options", array());
     // get user info
     $customer_model = $this->getModel('Customer');
     $cust = $customer_model->getUserByID($order->userid);
     $this->assign("cust", $cust);
     // plugins
     $this->assign("plugins", $order->processor);
     // promocode
     if ($order->promocode == 0) {
         $order->promocode = 'none';
     }
     $this->assign("promocode", $order->promocode);
     // products
     $products = array();
     if ($order->products) {
         $products = $order->products;
         foreach ($products as $key => $product) {
             //print_r($product);die;
             // get Plain
             //orderDetails
             /*
             $license = $this->_models['license']->getLicense( $product->lid );
             $products[$key]->license = $license;
             
             if ($license->renew) {
             	$plans = $this->_models['plain']->getPlanitemRenewal($product->id, $license->plan_id);
             } else {
             	$plans = $this->_models['plain']->getPlanitemNew($product->id, $license->plan_id);
             }
             $products[$key]->plans = $plans;
             
             // get renew license
             if ( $license->renewlicid != -1 ) {
             	$renewlicense = $this->_models['license']->getLicense( $license->renewlicid );
             	$products[$key]->renewlicense = $renewlicense;
             } else {
             	$products[$key]->renewlicense = null;
             }
             */
         }
     }
     //dsdebug($products);die;
     $this->assign("products", $products);
     $this->assign("amount_paid", $order->amount_paid);
     $this->assign("total", $order->amount);
     $this->assign("tax", '0');
     DigiComHelperDigiCom::addSubmenu('orders');
     $this->sidebar = DigiComHelperDigiCom::renderSidebar();
     parent::display($tpl);
 }
Ejemplo n.º 18
0
        echo trim($order->status) != "in_progres" ? $order->status : "Active";
        ?>
							</span>
							<a href="<?php 
        echo $orderstatuslink;
        ?>
" title="<?php 
        echo JText::_('COM_DIGICOM_ORDER_STATUS_CHANGE_FROM_' . strtoupper($order->status));
        ?>
" class="hasTooltip">
								<i class="icon-refresh"></i>
							</a>
							
 -->
 							<?php 
        echo DigiComHelperDigiCom::getOrderSratusList($order->status, $i, $order);
        ?>
						</td>
						<td align="center">
							<?php 
        echo $order->processor;
        ?>
						</td>
						
					</tr>
					<?php 
        $k = 1 - $k;
    }
    ?>
				<?php 
} else {
Ejemplo n.º 19
0
								</span>
							</td>
							<td>
								<strong class="row-title">
									<a href="index.php?option=com_digicom&view=customer&layout=edit&id=<?php 
    echo $order->userid;
    ?>
">
										<?php 
    echo $order->firstname . ' ' . $order->lastname;
    ?>
									</a>
								</strong>
							</td>
							<td><span class="small pull-right"><?php 
    echo DigiComHelperDigiCom::format_price($order->amount, $order->currency, true, $configs);
    ?>
</span></td>
							<td><span class="small"><?php 
    echo date("Y-m-d", $order->order_date);
    ?>
</span></td>
						</tr>
						
					<?php 
}
?>
					</table>
					<a href="index.php?option=com_digicom&view=orders"><?php 
echo JText::_('COM_DIGICOM_ALL_ORDERS');
?>
Ejemplo n.º 20
0
				<tr>
					<td>Product Name</td>
					<td width="100px">Price</td>
					<td width="1%">Action</td>
				</tr>
			</thead>
			<tbody id="productincludes_items">
				<?php 
$bundle_product = $form_data->get('bundle_product');
if (isset($bundle_product) && count($bundle_product) > 0) {
    foreach ($bundle_product as $key => $include) {
        if (is_array($include)) {
            $include = (object) $include;
        }
        $iprice = isset($include->price) ? $include->price : '';
        $price = DigiComHelperDigiCom::format_price($iprice, $configs->get('currency', 'USD'), true, $configs);
        ?>
						<tr id="productincludes_item_<?php 
        echo $include->id;
        ?>
">
							<td>
								<input type="hidden" id="product_include_id<?php 
        echo $include->id;
        ?>
" name="jform[bundle_product][]" value="<?php 
        echo $include->id;
        ?>
">
								<a href="<?php 
        echo JRoute::_('index.php?option=com_digicom&view=product&layout=edit&id=' . $include->id);
Ejemplo n.º 21
0
 public static function createTotalDiagram($report, $startdate, $enddate, $configs)
 {
     $diagram = "";
     $edit_line = DigiComDiagram::getEditLine($report, $startdate, $enddate, $configs);
     $max_amout = 0;
     foreach ($edit_line as $key => $value) {
         $sum = ceil(DigiComDiagram::getAmount($report, $startdate, $enddate, $key));
         if ($max_amout < $sum) {
             $max_amout = $sum;
         }
     }
     $roud_max_amount = $max_amout;
     if ($max_amout > 10) {
         $roud_max_amount = DigiComDiagram::roundToMax($max_amout);
     }
     $scale = DigiComDiagram::getSumScale($report, $roud_max_amount);
     $padding = array("0" => "0", "1" => "50", "2" => "50", "3" => "50");
     $width = "40%";
     $margin_left = "";
     if ($report == "monthly") {
         $width = "70%";
         $margin_left = "margin-left:35px !important;";
     }
     $diagram .= '<table style="width:' . $width . '">';
     $diagram .= '<tr>';
     $diagram .= '<td width="60px" align="right">';
     //start sum line ------------------------------------------
     $diagram .= '<div id="sum_line">';
     if (isset($scale) && count($scale) > 0) {
         foreach ($scale as $key => $value) {
             $diagram .= '<div style="padding-top: ' . $padding[$key] . 'px;">' . $value . ' -</div>';
         }
         $diagram .= '<div style="padding-top: 50px;">0</div>';
     }
     $diagram .= '</div>';
     //end sum line ------------------------------------------
     $diagram .= '</td>';
     $diagram .= '<td id="td_lines">';
     $diagram .= '<table style="margin-bottom:-5px;"><tr>';
     if (isset($edit_line) && count($edit_line) > 0) {
         foreach ($edit_line as $key => $value) {
             $diagram .= '<td style="width:40px;" nowrap="nowrap">';
             $diagram .= '<div id="all_element">';
             $diagram .= '<div id="diagram_element" style="' . $margin_left . '">';
             $sum = DigiComDiagram::getAmount($report, $startdate, $enddate, $key);
             if (isset($sum)) {
                 $total = str_replace(",", "", $scale["0"]);
                 $padding = $sum * 270 / $total;
                 $padding = intval(270 - $padding);
                 $padding = $padding > 258 ? 258 : $padding;
                 $sum = DigiComHelperDigiCom::format_price($sum, $configs->get('currency', 'USD'), true, $configs);
             } else {
                 $padding = 270;
                 $sum = "";
             }
             $diagram .= '<div style="background-color: #FFFFFF; padding-top: ' . $padding . 'px;">';
             $diagram .= '<span style="font-size: smaller; white-space: nowrap;">' . $sum . "</span>";
             $diagram .= '</div>';
             $diagram .= '</div>';
             $diagram .= '</div>';
             $diagram .= '</td>';
         }
     }
     $diagram .= '</tr></table>';
     $diagram .= '</td>';
     $diagram .= '</tr>';
     //start edit line ------------------------------------------
     $diagram .= '<tr>';
     if (isset($edit_line) && count($edit_line) > 0) {
         $diagram .= '<td>';
         $diagram .= '</td>';
         $diagram .= '<td>';
         $diagram .= '<table>';
         $diagram .= '<tr>';
         foreach ($edit_line as $key => $value) {
             $width = " width: 30px; ";
             if ($key != count($edit_line) - 1) {
                 $width = " width: 50px; ";
             }
             $diagram .= '<td style="' . $width . ' text-align:right;">';
             $diagram .= $value;
             $diagram .= '</td>';
         }
         $diagram .= '</tr>';
         $diagram .= '</table>';
         $diagram .= '</td>';
     }
     $diagram .= '<tr>';
     //end edit line ------------------------------------------
     $diagram .= '</table>';
     return $diagram;
 }
Ejemplo n.º 22
0
<?php

/**
 * @package		DigiCom
 * @author 		ThemeXpert http://www.themexpert.com
 * @copyright	Copyright (c) 2010-2015 ThemeXpert. All rights reserved.
 * @license 	GNU General Public License version 3 or later; see LICENSE.txt
 * @since 		1.0.0
 */
defined('_JEXEC') or die;
JLoader::discover('DigiComHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
JLoader::discover('DigiComSiteHelper', JPATH_COMPONENT_SITE . '/helpers');
JHtml::_('behavior.tabstate');
if (!JFactory::getUser()->authorise('core.manage', 'com_digicom')) {
    return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$controller = JControllerLegacy::getInstance('Digicom');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
DigiComHelperDigiCom::setSidebarRight();
Ejemplo n.º 23
0
 /**
  * Get latest products, to use with DS Dashboard
  * @return unknown
  */
 public static function getMostSoldProducts($limit)
 {
     $db = JFactory::getDbo();
     // Create a new query object.
     $query = $db->getQuery(true);
     $query->select('SUM(' . $db->quoteName('od.quantity') . ') as total');
     $query->select($db->quoteName(array('od.productid', 'od.package_type')));
     $query->select($db->quoteName(array('p.name', 'p.price')));
     $query->from($db->quoteName('#__digicom_orders_details') . ' od');
     $query->from($db->quoteName('#__digicom_products') . ' p');
     $query->where($db->quoteName('p.id') . '= ' . $db->quoteName('od.productid'));
     $date = DigiComHelperDigiCom::getStartEndDateMonth();
     $startdate_str = $date["0"];
     $enddate_str = $date["1"];
     $query->where($db->quoteName('od.purchase_date') . ' >= ' . $db->quote($startdate_str));
     $query->where($db->quoteName('od.purchase_date') . ' < ' . $db->quote($enddate_str));
     $query->where($db->quoteName('od.published') . ' = ' . $db->quote('1'));
     $query->group($db->quoteName('od.productid'));
     $query->order($db->quoteName('total') . ' DESC');
     $query->setLimit($limit);
     // Reset the query using our newly populated query object.
     $db->setQuery($query);
     if (!($products = $db->loadObjectList())) {
         echo $db->getErrorMsg();
     }
     return $products;
 }
Ejemplo n.º 24
0
</a>
						</td>

						<td>
							<a href="<?php 
    echo $link;
    ?>
" ><?php 
    echo $promo->code;
    ?>
</a>
						</td>

						<td align="center">
							<?php 
    echo $promo->promotype == '0' ? DigiComHelperDigiCom::format_price($promo->amount, $configs->get('currency', 'USD'), true, $configs) : $promo->amount . ' %';
    ?>
						</td>

						<td align="center">
							<?php 
    echo $status;
    ?>
						</td>

						<td align="center">
							<?php 
    echo $promo->used;
    ?>
						</td>
Ejemplo n.º 25
0
						<td>
							<?php 
    switch ($item->product_type) {
        case 'bundle':
            echo JText::_('COM_DIGICOM_PRODUCTS_TYPE_BUNDLE');
            break;
        case 'reguler':
        default:
            echo JText::_('COM_DIGICOM_PRODUCTS_TYPE_SINGLE');
            break;
    }
    ?>
						</td>
						<td class="small">
							<?php 
    echo DigiComHelperDigiCom::format_price($item->price, $this->configs->get('currency', 'USD'), true, $this->configs);
    ?>
						</td>
						<td class="small hidden-phone">
								<?php 
    echo DigiComSiteHelperPrice::getProductValidityPeriod($item);
    ?>
						</td>
						<td align="center" style="text-align: center; ">
							<?php 
    echo $item->hide_public ? '<span class="label label-important">' . JText::_("JNO") . '</span>' : '<span class="label label-success">' . JText::_("JYES") . '</span>';
    ?>
						</td>
						<td class="small hidden-phone">
							<?php 
    echo $this->escape($item->access_level);
Ejemplo n.º 26
0
 function sendApprovedEmail($cid = 0, $type = 'complete_order', $status = 'Active', $paid = '')
 {
     if ($cid < 1) {
         return;
     }
     $db = JFactory::getDBO();
     $order = $this->getTable("Order");
     $order->load($cid);
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $cust_info = $this->getTable("Customer");
     $cust_info->load($order->userid);
     $my = $cust_info;
     /*		
     $emailinfo = $configs->get('email');
     $message = $emailinfo->$type->body;
     $subject = $emailinfo->$type->subject;
     */
     //echo $type;die;
     $email_settings = $configs->get('email_settings');
     $email_header_image = $email_settings->email_header_image;
     //jform[email_settings][email_header_image]
     if (!empty($email_header_image)) {
         $email_header_image = '<img src="' . JRoute::_(JURI::root() . $email_header_image) . '" />';
     }
     $phone = $configs->get('phone');
     $email_footer = $email_settings->email_footer;
     $emailinfo = $configs->get($type, 'new_order');
     $email_type = $emailinfo->email_type;
     $Subject = $emailinfo->Subject;
     $recipients = $emailinfo->recipients;
     $enable = $emailinfo->enable;
     $heading = $emailinfo->heading;
     //jform[email_settings][heading]
     if (!$enable) {
         return;
     }
     //print_r($emailinfo);die;
     //-----------------------------------------------------------------------
     $path = '/components/com_digicom/emails/';
     switch ($type) {
         case 'new_order':
             $emailType = JText::_('COM_DIGIOM_NEW_ORDER');
             $filename = 'new-order.' . $email_type . '.php';
             break;
         case 'process_order':
             $emailType = JText::_('COM_DIGIOM_PROCESS_ORDER');
             $filename = 'process-order.' . $email_type . '.php';
             break;
         case 'cancel_order':
             $emailType = JText::_('COM_DIGIOM_CANCEL_ORDER');
             $filename = 'cancel-order.' . $email_type . '.php';
             break;
         case 'complete_order':
             $emailType = JText::_('COM_DIGIOM_COMPLETE_ORDER');
             $filename = 'complete-order.' . $email_type . '.php';
             break;
     }
     $override = '/html/com_digicom/emails/';
     $template = $this->getTemplate();
     $client = JApplicationHelper::getClientInfo($template->client_id);
     $filePath = JPath::clean($client->path . '/templates/' . $template->template . $override . '/' . $filename);
     //echo $filePath;die;
     if (file_exists($filePath)) {
         $emailbody = file_get_contents($filePath);
     } else {
         $filePath = JPath::clean($client->path . $path . '/' . $filename);
         $emailbody = file_get_contents($filePath);
     }
     //echo $emailbody;die;
     //-----------------------------------------------------------------------
     //$email = $configs->get('email');
     /*$message = $email->$type->body;
     		$subject = $email->$type->subject;
     		*/
     $message = $emailbody;
     $subject = $Subject;
     $mes = new stdClass();
     $promo = new stdClass();
     //$cart->get_promo($cust_info);
     $promo->id = $order->promocodeid;
     $promo->code = $order->promocode;
     if ($promo->id > 0) {
         $promoid = $promo->id;
         $promocode = $promo->code;
     } else {
         $promoid = '0';
         $promocode = '0';
     }
     $amount = DigiComHelperDigiCom::format_price($paid ? $paid : $order->amount, $configs->get('currency', 'USD'), true, $configs);
     $timestamp = time();
     $app = JFactory::getApplication('administrator');
     $sitename = trim($configs->get('store_name', 'DigiCom Store')) != '' ? $configs->get('store_name', 'DigiCom Store') : $app->getCfg('sitename');
     $siteurl = trim($configs->get('store_url', JURI::root())) != '' ? $configs->get('store_url', JURI::root()) : JURI::root();
     $message = str_replace("[SITENAME]", $sitename, $message);
     $message = str_replace("[EMAIL_TYPE]", $emailType, $message);
     $message = str_replace("[EMAIL_HEADER]", $heading, $message);
     $message = str_replace("[HEADER_IMAGE]", $email_header_image, $message);
     $message = str_replace("../%5BSITEURL%5D", $siteurl, $message);
     $message = str_replace("%5BSITEURL%5D", $siteurl, $message);
     $message = str_replace("[SITEURL]", $siteurl, $message);
     $message = str_replace("[CUSTOMER_USER_NAME]", $my->username, $message);
     $message = str_replace("[CUSTOMER_FIRST_NAME]", $my->firstname, $message);
     $message = str_replace("[CUSTOMER_LAST_NAME]", $my->lastname, $message);
     $message = str_replace("[CUSTOMER_EMAIL]", $my->email, $message);
     $message = str_replace("[ORDER_DATE]", date($configs->get('time_format', 'DD-MM-YYYY'), $timestamp), $message);
     $message = str_replace("[ORDER_ID]", $cid, $message);
     $message = str_replace("[ORDER_AMOUNT]", $amount, $message);
     $message = str_replace("[NUMBER_OF_PRODUCTS]", $order->number_of_products, $message);
     $message = str_replace("[DISCOUNT_AMOUNT]", $order->promocodediscount, $message);
     $message = str_replace("[ORDER_STATUS]", $status, $message);
     $message = str_replace("[STORE_PHONE]", $phone, $message);
     $message = str_replace("[FOOTER_TEXT]", $email_footer, $message);
     $displayed = array();
     $product_list = '';
     $sql = "select od.*, p.name from #__digicom_orders_details od, #__digicom_products p where od.productid=p.id and od.orderid=" . $cid;
     $db->setQuery($sql);
     $items = $db->loadObjectList();
     $product_list = "";
     foreach ($items as $item) {
         $product_list .= $item->quantity . " - " . $item->name . '<br />';
     }
     $message = str_replace("[PRODUCTS]", $product_list, $message);
     //subject
     $subject = str_replace("[SITENAME]", $sitename, $subject);
     $subject = str_replace("../%5BSITEURL%5D", $siteurl, $subject);
     $subject = str_replace("%5BSITEURL%5D", $siteurl, $subject);
     $subject = str_replace("[SITEURL]", $siteurl, $subject);
     $subject = str_replace("[CUSTOMER_USER_NAME]", $my->username, $subject);
     $subject = str_replace("[CUSTOMER_FIRST_NAME]", $my->firstname, $subject);
     $subject = str_replace("[CUSTOMER_LAST_NAME]", $my->lastname, $subject);
     $subject = str_replace("[CUSTOMER_EMAIL]", $my->email, $subject);
     $subject = str_replace("[ORDER_DATE]", date($configs->get('time_format', 'DD-MM-YYYY'), $timestamp), $subject);
     $subject = str_replace("[ORDER_ID]", $cid, $subject);
     $subject = str_replace("[ORDER_AMOUNT]", $amount, $subject);
     $subject = str_replace("[NUMBER_OF_PRODUCTS]", $order->number_of_products, $subject);
     $subject = str_replace("[DISCOUNT_AMOUNT]", $order->promocodediscount, $subject);
     $subject = str_replace("[ORDER_STATUS]", $status, $subject);
     $subject = str_replace("{site_title}", $sitename, $subject);
     $subject = str_replace("{order_number}", $cid, $subject);
     $subject = str_replace("{order_date}", date($configs->get('time_format', 'd-m-Y'), $timestamp), $subject);
     $message = str_replace("{site_title}", $sitename, $message);
     $message = str_replace("{order_number}", $cid, $message);
     $message = str_replace("{order_date}", date($configs->get('time_format', 'd-m-Y'), $timestamp), $message);
     $subject = str_replace("[PRODUCTS]", $product_list, $subject);
     //replace styles
     $basecolor = $email_settings->email_base_color;
     //
     $basebgcolor = $email_settings->email_bg_color;
     //
     $tmplcolor = $email_settings->email_body_color;
     //
     $tmplbgcolor = $email_settings->email_body_bg_color;
     //
     $message = str_replace("[BASE_COLOR]", $basecolor, $message);
     $message = str_replace("[BASE_BG_COLOR]", $basebgcolor, $message);
     $message = str_replace("[TMPL_COLOR]", $tmplcolor, $message);
     $message = str_replace("[TMPL_BG_COLOR]", $tmplbgcolor, $message);
     $subject = html_entity_decode($subject, ENT_QUOTES);
     $message = html_entity_decode($message, ENT_QUOTES);
     // Send email to user
     //global $mosConfig_mailfrom, $mosConfig_fromname, $configs;
     $mosConfig_mailfrom = $app->getCfg("mailfrom");
     $mosConfig_fromname = $app->getCfg("fromname");
     if ($configs->get('usestoremail', 0) == '1' && strlen(trim($configs->get('store_name', 'DigiCom Store'))) > 0 && strlen(trim($configs->get('store_email', JFactory::getConfig()->get('mailfrom')))) > 0) {
         $adminName2 = $configs->get('store_name', 'DigiCom Store');
         $adminEmail2 = $configs->get('store_email', JFactory::getConfig()->get('mailfrom'));
     } else {
         if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
             $adminName2 = $mosConfig_fromname;
             $adminEmail2 = $mosConfig_mailfrom;
         } else {
             $query = "SELECT name, email" . "\n FROM #__users" . "\n WHERE LOWER( usertype ) = 'superadministrator'" . "\n OR LOWER( usertype ) = 'super administrator'";
             $database->setQuery($query);
             $rows = $database->loadObjectList();
             $row2 = $rows[0];
             $adminName2 = $row2->name;
             $adminEmail2 = $row2->email;
         }
     }
     $mailSender = JFactory::getMailer();
     $mailSender->IsHTML(true);
     $mailSender->addRecipient($my->email);
     $mailSender->setSender(array($adminEmail2, $adminName2));
     $mailSender->setSubject($subject);
     $mailSender->setBody($message);
     if (!$mailSender->Send()) {
         //<Your error code management>
     }
     //	mosMail( $adminEmail2, $adminName2, $my->email, $subject, $message, 1 ); // Send mail
     if ($configs->get('sendmailtoadmin', 0) != 0) {
         $mailSender = JFactory::getMailer();
         $mailSender->IsHTML(true);
         $mailSender->addRecipient($adminEmail2);
         $mailSender->setSender(array($adminEmail2, $adminName2));
         $mailSender->setSubject($subject);
         $mailSender->setBody($message);
         if (!$mailSender->Send()) {
             //<Your error code management>
         }
         //mosMail( $adminEmail2, $adminName2, $adminEmail2, $subject, $message, 1 ); // Send mail
     }
     return true;
 }