Ejemplo n.º 1
0
 /**
  * Display default page
  *
  * @return     void
  */
 public function defaultTask()
 {
     $config = $this->config;
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     $this->view->config = $config;
     $this->view->display();
 }
Ejemplo n.º 2
0
 /**
  * Display default page
  *
  * @return     void
  */
 public function homeTask()
 {
     // get categories
     $categories = $this->warehouse->getRootCategories();
     $this->view->categories = $categories;
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     $this->view->display();
 }
Ejemplo n.º 3
0
 /**
  * Build the "trail"
  *
  * @return  void
  */
 protected function _buildPathway()
 {
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     Pathway::append(Lang::txt('COM_PUBLICATIONS_CURATION'), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=display');
     if ($this->_pub) {
         Pathway::append($this->_pub->title, 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=view' . '&id=' . $this->_pub->id);
     }
 }
Ejemplo n.º 4
0
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
if (Pathway::count() <= 0) {
    Pathway::append(Lang::txt('COM_BLOG'), 'index.php?option=' . $this->option);
}
Pathway::append($this->row->published('Y'), 'index.php?option=' . $this->option . '&year=' . $this->row->published('Y'));
Pathway::append($this->row->published('m'), 'index.php?option=' . $this->option . '&year=' . $this->row->published('Y') . '&month=' . sprintf("%02d", $this->row->published('m')));
Pathway::append(stripslashes($this->row->get('title')), $this->row->link());
Document::setTitle(Lang::txt('COM_BLOG') . ': ' . stripslashes($this->row->get('title')));
$this->css()->js();
$first = $this->archive->entries(array('state' => $this->filters['state'], 'authorized' => $this->filters['authorized']))->order('publish_up', 'asc')->limit(1)->row();
?>
<header id="content-header">
	<h2><?php 
echo Lang::txt('COM_BLOG');
?>
</h2>
Ejemplo n.º 5
0
 /**
  * Method to set the document path
  *
  * @return  void
  */
 protected function _buildPathway()
 {
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     if ($this->_task) {
         Pathway::append(Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&task=' . $this->_task);
     }
 }
Ejemplo n.º 6
0
 /**
  * Display default page
  *
  * @return     void
  */
 public function homeTask()
 {
     $cart = new CurrentCart();
     //print_r($this); die;
     // Initialize errors array
     $errors = array();
     // Update cart if needed
     $updateCartRequest = Request::getVar('updateCart', false, 'post');
     // If pIds are posted, convert them to SKUs
     $pIds = Request::getVar('pId', false, 'post');
     //print_r($pIds); die;
     $skus = Request::getVar('skus', false, 'post');
     if ($updateCartRequest && ($pIds || $skus)) {
         if (!empty($pIds)) {
             $skus = array();
             $warehouse = new Warehouse();
             foreach ($pIds as $pId => $qty) {
                 $product_skus = $warehouse->getProductSkus($pId);
                 // each pId must map to one SKU, otherwise ignored, since there is no way which SKU is being added
                 // Must be only one sku...
                 if (sizeof($product_skus) != 1) {
                     continue;
                 }
                 $skus[$product_skus[0]] = $qty;
             }
         } else {
             if (!is_array($skus)) {
                 $skus = array($skus => 1);
             }
         }
         //print_r($skus); die;
         // Turn off syncing to prevent redundant session update queries
         $cart->setSync(false);
         foreach ($skus as $sId => $qty) {
             try {
                 $cart->update($sId, $qty);
             } catch (\Exception $e) {
                 $cart->setMessage($e->getMessage(), 'error');
             }
         }
         // set flag to redirect
         $redirect = true;
         if ($cart->hasMessages()) {
             $redirect = false;
         }
     } else {
         $allPost = Request::request();
         foreach ($allPost as $var => $val) {
             if ($val == 'delete') {
                 $toDelete = explode('_', $var);
                 if ($toDelete[0] == 'delete') {
                     $sId = $toDelete[1];
                     // Delete the requested item by setting its QTY to zero
                     $redirect = true;
                     try {
                         $cart->update($sId, 0);
                     } catch (\Exception $e) {
                         $cart->setMessage($e->getMessage(), 'error');
                         $redirect = false;
                     }
                 }
             }
         }
     }
     // Add coupon if needed
     $addCouponRequest = Request::getVar('addCouponCode', false, 'post');
     $couponCode = Request::getVar('couponCode', false, 'post');
     if ($addCouponRequest && $couponCode) {
         // Sync cart before pontial coupons applying
         $cart->getCartInfo(true);
         // Add coupon
         try {
             $cart->addCoupon($couponCode);
         } catch (\Exception $e) {
             $cart->setMessage($e->getMessage(), 'error');
         }
         // set flag to redirect
         $redirect = true;
         if ($cart->hasMessages()) {
             $redirect = false;
         }
     }
     // Check for express add to cart
     if (!empty($redirect) && $redirect) {
         // If this is an express checkout (go to the confirm page right away) there shouldn't be any items in the cart
         // Since redirect is set, there are no errors
         $expressCheckout = Request::getVar('expressCheckout', false, 'post');
         // make sure the cart is empty
         if ($expressCheckout && !empty($skus) && $cart->isEmpty()) {
             // Get the latest synced cart info, it will also enable cart syncing that was turned off before
             $cart->getCartInfo(true);
             // Redirect directly to checkout, skip the cart page
             App::redirect(Route::url('index.php?option=' . $this->_option) . DS . 'checkout');
         }
         // prevent resubmitting form by refresh
         // redirect to cart
         App::redirect(Route::url('index.php?option=' . $this->_option));
     }
     // Get the latest synced cart info, it will also enable cart syncing that was turned off before
     $cartInfo = $cart->getCartInfo(true);
     $this->view->cartInfo = $cartInfo;
     // Handle coupons
     $couponPerks = $cart->getCouponPerks();
     //print_r($couponPerks); die;
     $this->view->couponPerks = $couponPerks;
     // Handle memberships
     $membershipInfo = $cart->getMembershipInfo();
     //print_r($membershipInfo); die;
     $this->view->membershipInfo = $membershipInfo;
     // At this point the cart is lifted and may have some issues/errors (say, after merging), get them
     if ($cart->hasMessages()) {
         $cartMessages = $cart->getMessages();
         $this->view->notifications = $cartMessages;
     }
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     $this->view->display();
 }
Ejemplo n.º 7
0
 /**
  * Build the "trail"
  *
  * @return  void
  */
 protected function _buildPathway()
 {
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     if (!empty($this->model) && $this->_identifier && ($this->_task == 'view' || $this->_task == 'serve' || $this->_task == 'wiki')) {
         $url = $this->_route;
         // Link to category
         Pathway::append($this->model->_category->name, 'index.php?option=' . $this->_option . '&category=' . $this->model->_category->url_alias);
         // Link to publication
         if ($this->_version && $this->_version != 'default') {
             $url .= '&v=' . $this->_version;
         }
         Pathway::append($this->model->version->title, $url);
         if ($this->_task == 'serve' || $this->_task == 'wiki') {
             Pathway::append(Lang::txt('COM_PUBLICATIONS_SERVING_CONTENT'), $this->_route . '&task=' . $this->_task);
         }
     } elseif (Pathway::count() <= 1 && $this->_task) {
         switch ($this->_task) {
             case 'browse':
             case 'submit':
                 if ($this->_task_title) {
                     Pathway::append($this->_task_title, 'index.php?option=' . $this->_option . '&task=' . $this->_task);
                 }
                 break;
             case 'start':
                 if ($this->_task_title) {
                     Pathway::append($this->_task_title, 'index.php?option=' . $this->_option . '&task=submit');
                 }
                 break;
             case 'block':
             case 'intro':
                 // Nothing
                 break;
             default:
                 Pathway::append(Lang::txt(strtoupper($this->_option . '_' . $this->_task)), 'index.php?option=' . $this->_option . '&task=' . $this->_task);
                 break;
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * Method to set the document path
  *
  * @param      array $course_pages List of roup pages
  * @return     void
  */
 public function _buildPathway($product)
 {
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     if ($this->_task) {
         Pathway::append(Lang::txt($product));
     }
 }
Ejemplo n.º 9
0
 /**
  * Build Breadcrumb Trail
  * 
  * @return  void
  */
 protected function _buildPathway()
 {
     // create breadcrumbs
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     // add "API"
     Pathway::append(Lang::txt('COM_DEVELOPER_API'), 'index.php?option=' . $this->_option . '&controller=api');
     // add "Applications"
     Pathway::append(Lang::txt('COM_DEVELOPER_API_APPLICATIONS'), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller);
     // do we have an application
     if ($appid = Request::getInt('id', 0)) {
         $application = Application::oneOrFail($appid);
         // add "Applications"
         Pathway::append($application->get('name'), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&id=' . $appid);
     }
     // add task
     if (isset($this->_task) && !in_array($this->_task, array('view', 'display', 'applications', 'granted'))) {
         // add "Applications"
         Pathway::append(Lang::txt('COM_DEVELOPER_API_APPLICATION_' . strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&id=' . $appid . '&task=' . $this->_task);
     }
     // add active
     if ($active = Request::getCmd('active', null)) {
         // add "Applications"
         Pathway::append(Lang::txt(ucfirst($active)), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&id=' . $appid . '&task=' . $this->_task);
     }
 }
Ejemplo n.º 10
0
 /**
  * Shipping step of the checkout
  *
  * @return     void
  */
 public function shippingTask()
 {
     $cart = new CurrentCart();
     // initialize address set var
     $addressSet = false;
     $params = $this->getParams(array('action', 'saId'));
     $errors = array();
     if (!empty($params) && !empty($params->action) && !empty($params->saId) && $params->action == 'select') {
         try {
             $this->selectSavedShippingAddress($params->saId, $cart);
             $addressSet = true;
         } catch (\Exception $e) {
             $errors[] = array($e->getMessage(), 'error');
         }
     }
     $transaction = $cart->liftTransaction();
     if (!$transaction) {
         // Redirect to cart if transaction cannot be lifted
         $cart->redirect('home');
     }
     // It is OK to come back to shipping and change the address
     $cart->setStepStatus('shipping', '', false);
     $nextStep = $cart->getNextCheckoutStep();
     // Double check that the current step is indeed shipping, redirect if needed
     if ($nextStep->step != 'shipping') {
         $cart->redirect($nextStep->step);
     }
     // handle non-ajax form submit
     $shippingInfoSubmitted = Request::getVar('submitShippingInfo', false, 'post');
     if ($shippingInfoSubmitted) {
         $res = $cart->setTransactionShippingInfo();
         if ($res->status) {
             $addressSet = true;
         } else {
             foreach ($res->errors as $error) {
                 $errors[] = array($error, 'error');
             }
         }
     }
     // Calculate shipping charge
     if ($addressSet) {
         // TODO Calculate shipping
         $shippingCost = 22.22;
         $cart->setTransactionShippingCost($shippingCost);
         $cart->setStepStatus('shipping');
         $nextStep = $cart->getNextCheckoutStep()->step;
         $cart->redirect($nextStep);
     }
     if (!empty($errors)) {
         $this->view->notifications = $errors;
     }
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     if ($this->_task) {
         Pathway::append(Lang::txt('Shipping'));
     }
     $savedShippingAddresses = $cart->getSavedShippingAddresses($this->juser->id);
     $this->view->savedShippingAddresses = $savedShippingAddresses;
     $this->view->display();
 }
Ejemplo n.º 11
0
 /**
  * This is a redirect page where the customer ends up after payment is complete
  *
  * @return     void
  */
 public function completeTask()
 {
     // Get payment provider
     $params = Component::params(Request::getVar('option'));
     $paymentGatewayProivder = $params->get('paymentProvider');
     // Get the transaction ID variable name to pull from URL
     require_once dirname(dirname(__DIR__)) . DS . 'lib' . DS . 'payment' . DS . 'PaymentDispatcher.php';
     $verificationVar = \PaymentDispatcher::getTransactionIdVerificationVarName($paymentGatewayProivder);
     if ($verificationVar) {
         // Check the GET values passed
         $customVar = Request::getVar($verificationVar, '');
         $tId = false;
         if (strstr($customVar, '-')) {
             $customData = explode('-', $customVar);
             $token = $customData[0];
             $tId = $customData[1];
         } else {
             $token = $customVar;
         }
         // Verify token
         if (!$token || !Cart::verifySecurityToken($token, $tId)) {
             die('Error processing your order. Failed to verify security token.');
         }
     }
     // Get transaction info
     $tInfo = Cart::getTransactionFacts($tId);
     //print_r($tId); die;
     //print_r($tInfo);die;
     if (empty($tInfo->info->tStatus) || $tInfo->info->tiCustomerStatus != 'unconfirmed' || $tInfo->info->tStatus != 'completed') {
         die('Error processing your order...');
         App::redirect(Route::url('index.php?option=' . $this->_option));
     }
     // Transaction ok
     // Reset the lookup to prevent displaying the page multiple times
     //$cart->updateTransactionCustomerStatus('confirmed', $tId);
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
         Pathway::append(Lang::txt('Order complete'), 'index.php?option=' . $this->_option);
     }
     // Display message
     $this->view->transactionInfo = $tInfo->info;
     $this->view->display();
 }
Ejemplo n.º 12
0
 /**
  * Build the "trail"
  *
  * @return  void
  */
 protected function _buildPathway()
 {
     $group_tasks = array('start', 'setup', 'view');
     $group = isset($this->group) ? $this->group : NULL;
     $active = isset($this->active) ? $this->active : NULL;
     // Point to group if group project
     if (is_object($group) && in_array($this->_task, $group_tasks)) {
         Pathway::clear();
         Pathway::append(Lang::txt('COM_PROJECTS_GROUPS_COMPONENT'), Route::url('index.php?option=com_groups'));
         Pathway::append(\Hubzero\Utility\String::truncate($group->get('description'), 50), Route::url('index.php?option=com_groups&cn=' . $group->cn));
         Pathway::append(Lang::txt('COM_PROJECTS_PROJECTS'), Route::url('index.php?option=com_groups&cn=' . $group->cn . '&active=projects'));
     } elseif (Pathway::count() <= 0) {
         Pathway::append(Lang::txt('COMPONENT_LONG_NAME'), Route::url('index.php?option=' . $this->_option));
     }
     // Project path
     if ($this->model->exists()) {
         $alias = $this->model->get('alias');
         $provisioned = $this->model->isProvisioned();
         $title = $this->model->get('title');
     }
     if (!empty($alias)) {
         if (!empty($provisioned)) {
             Pathway::append(stripslashes(Lang::txt('COM_PROJECTS_PROVISIONED_PROJECT')), Route::url('index.php?option=' . $this->_option . '&alias=' . $alias . '&action=activate'));
         } else {
             Pathway::append(stripslashes($title), Route::url('index.php?option=' . $this->_option . '&alias=' . $alias));
         }
     }
     // Controllers
     switch ($this->_controller) {
         case 'reports':
             Pathway::append(Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_controller)), Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller));
             break;
         default:
             break;
     }
     // Task is set?
     if (!$this->_task) {
         return;
     }
     // Tasks
     switch ($this->_task) {
         case 'view':
             if ($active && !empty($alias)) {
                 switch ($active) {
                     case 'feed':
                         // nothing to add
                         break;
                     default:
                         Pathway::append(ucfirst(Lang::txt('COM_PROJECTS_TAB_' . strtoupper($this->active))), Route::url('index.php?option=' . $this->_option . '&alias=' . $alias . '&active=' . $active));
                         break;
                 }
             }
             break;
         case 'setup':
         case 'edit':
             if (empty($alias)) {
                 Pathway::append(Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_task)), Route::url('index.php?option=' . $this->_option . '&task=' . $this->_task));
                 break;
             }
             break;
         case 'browse':
         case 'process':
             $reviewer = Request::getWord('reviewer', '');
             if ($reviewer == 'sponsored' || $reviewer == 'sensitive') {
                 $title = $reviewer == 'sponsored' ? Lang::txt('COM_PROJECTS_REVIEWER_SPS') : Lang::txt('COM_PROJECTS_REVIEWER_HIPAA');
                 Pathway::append($title, Route::url('index.php?option=' . $this->_option . '&task=browse&reviewer=' . $reviewer));
             } else {
                 Pathway::append(Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_task)), Route::url('index.php?option=' . $this->_option . '&task=' . $this->_task));
             }
             break;
         case 'intro':
         case 'activate':
             // add nothing else
             break;
         default:
             Pathway::append(Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_task)), Route::url('index.php?option=' . $this->_option . '&task=' . $this->_task));
             break;
     }
 }
Ejemplo n.º 13
0
 /**
  * Display default page
  *
  * @return     void
  */
 public function homeTask()
 {
     // Incoming
     $this->view->filters = array('limit' => Request::getInt('limit', Config::get('list_limit')), 'start' => Request::getInt('limitstart', 0));
     $cart = new CurrentCart();
     // Get all completed transactions count
     $this->view->total = $cart->getTransactions(array('count' => true));
     // Get all completed transactions
     $transactions = $cart->getTransactions($this->view->filters);
     // Get transactions' info
     if ($transactions) {
         foreach ($transactions as $transaction) {
             $transactionInfo = Cart::getTransactionInfo($transaction->tId);
             // Figure out if the items int the transactions are still avaialble
             $tItems = unserialize($transactionInfo->tiItems);
             foreach ($tItems as $item) {
                 // Check if the product is still available
                 $warehouse = new Warehouse();
                 $skuInfo = $warehouse->getSkuInfo($item['info']->sId, false);
                 $item['info']->available = true;
                 if (!$skuInfo) {
                     // product no longer available
                     $item['info']->available = false;
                 }
             }
             $transactionInfo->tiItems = $tItems;
             $transaction->tInfo = $transactionInfo;
         }
     }
     $this->view->transactions = $transactions;
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
         Pathway::append(Lang::txt('COM_CART_ORDERS'), 'index.php?option=' . $this->_option);
     }
     //print_r($transactions); die;
     $this->view->display();
 }
Ejemplo n.º 14
0
 /**
  * Summary step of the checkout
  *
  * @return     void
  */
 public function summaryTask()
 {
     $cart = new CurrentCart();
     $transaction = $cart->liftTransaction();
     if (!$transaction) {
         $cart->redirect('home');
     }
     // Generate security token
     $token = $cart->getToken();
     // Check if there are any steps missing. Redirect if needed
     $nextStep = $cart->getNextCheckoutStep()->step;
     if ($nextStep != 'summary') {
         $cart->redirect($nextStep);
     }
     $cart->finalizeTransaction();
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     if ($this->_task) {
         Pathway::append(Lang::txt('Review your order'));
     }
     $this->view->token = $token;
     $this->view->transactionItems = $transaction->items;
     $this->view->transactionInfo = $transaction->info;
     $this->view->display();
 }