public function productList()
 {
     require $this->path . 'database/product.php';
     $product = new Product($this->path);
     $itemMass = $product->getList($_SESSION['userId']);
     if (!is_array($itemMass)) {
         header('Location: /error.html', true, 301);
     } else {
         require $this->path . 'views/list.php';
     }
 }
Example #2
0
 private function getResults($separator = 'OR')
 {
     $where = array();
     $bindings = array();
     foreach ($this->filters as $key => $value) {
         $operator = strpos($value, '%') !== false ? 'LIKE' : '=';
         $where[] = $key . ' ' . $operator . ' :' . $key;
         $bindings[$key] = $value;
     }
     if (!empty($where)) {
         $sql = 'SELECT * FROM product WHERE 1 AND (' . implode(' ' . $separator . ' ', $where) . ')';
         $this->results = Product::getList($sql, $bindings);
         $this->count = count($this->results);
     }
     return $this;
 }
Example #3
0
        if (count($item) == 1) {
            $email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($item[0]), $item[0]);
            $tpl->assign(array('issue_summary' => $email_details['sup_subject'], 'issue_description' => $email_details['seb_body']));
            // also auto pre-fill the customer contact text fields
            if (CRM::hasCustomerIntegration($prj_id)) {
                $sender_email = Mail_Helper::getEmailAddress($email_details['sup_from']);
                try {
                    $contact = $crm->getContactByEmail($sender_email);
                    $tpl->assign('contact_details', $contact->getDetails());
                } catch (CRMException $e) {
                }
            }
        }
    }
}
$tpl->assign(array('cats' => Category::getAssocList($prj_id), 'priorities' => Priority::getAssocList($prj_id), 'severities' => Severity::getList($prj_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'releases' => Release::getAssocList($prj_id), 'custom_fields' => Custom_Field::getListByProject($prj_id, 'report_form'), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true), 'field_display_settings' => Project::getFieldDisplaySettings($prj_id), 'groups' => Group::getAssocList($prj_id), 'products' => Product::getList(false)));
$prefs = Prefs::get($usr_id);
$tpl->assign('user_prefs', $prefs);
$tpl->assign('zones', Date_Helper::getTimezoneList());
if (Auth::getCurrentRole() == User::getRoleID('Customer')) {
    $crm = CRM::getInstance(Auth::getCurrentProject());
    $customer_contact_id = User::getCustomerContactID($usr_id);
    $contact = $crm->getContact($customer_contact_id);
    $customer_id = Auth::getCurrentCustomerID();
    $customer = $crm->getCustomer($customer_id);
    // TODOCRM: Pull contacts via ajax when user selects contract
    $tpl->assign(array('customer_id' => $customer_id, 'contact_id' => $customer_contact_id, 'customer' => $customer, 'contact' => $contact));
}
$clone_iss_id = isset($_GET['clone_iss_id']) ? (int) $_GET['clone_iss_id'] : null;
if ($clone_iss_id && Access::canCloneIssue($clone_iss_id, $usr_id)) {
    $tpl->assign(Issue::getCloneIssueTemplateVariables($clone_iss_id));
Example #4
0
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/products.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
    Misc::setMessage('Sorry, you are not allowed to access this page.', Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
if (@$_POST['cat'] == 'new') {
    $res = Product::insert($_POST['title'], $_POST['version_howto'], $_POST['rank'], @$_POST['removed'], @$_POST['email']);
    Misc::mapMessages($res, array(1 => array('Thank you, the product was added successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to add the product.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
    $res = Product::update($_POST['id'], $_POST['title'], $_POST['version_howto'], $_POST['rank'], @$_POST['removed'], @$_POST['email']);
    Misc::mapMessages($res, array(1 => array('Thank you, the product was updated successfully.', Misc::MSG_INFO), -1 => array('An error occurred while trying to update the product.', Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
    Product::remove($_POST['items']);
}
if (@$_GET['cat'] == 'edit') {
    $info = Product::getDetails($_GET['id']);
    $tpl->assign('info', $info);
    $user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, false, $_GET['id']);
} else {
    $user_options = User::getActiveAssocList(Auth::getCurrentProject(), User::ROLE_CUSTOMER, true);
}
$tpl->assign('list', Product::getList());
$tpl->assign('project_list', Project::getAll());
$tpl->displayTemplate();
Example #5
0
<?php

require_once 'config/config.conf.php';
try {
    $slider_pictures = glob('img/slider/*.{jpeg,jpg,png}', GLOB_BRACE);
    $products = Product::getList('SELECT * FROM product ORDER BY date DESC LIMIT 6');
    //echo Utils::debug($products);
    $best_rated_products = Product::getList('SELECT * FROM product ORDER BY rating DESC LIMIT 3');
    // Mélange le tableau
    shuffle($best_rated_products);
    $smarty = new Smarty();
    $tpl_vars = array('pages' => $pages, 'current_page' => $current_page, 'slider_pictures' => $slider_pictures, 'products' => $products, 'best_rated_products' => $best_rated_products);
    $smarty->assign($tpl_vars);
    $smarty->display('index.tpl');
    // Equivalent des lignes 16 + 18
    //$smarty->display('index.tpl', $tpl_vars);
} catch (Exception $e) {
    echo $e->getMessage();
    exit;
}
Example #6
0
/**
 * @version $Header$
 * @package warehouse
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
$gBitSystem->verifyPackage('warehouse');
if (!$gBitUser->hasUserPermission('p_warehouse_view')) {
    $gBitSystem->fatalError('You do not have prermission to view this package');
}
require_once WAREHOUSE_PKG_PATH . 'Product.php';
global $gBitSystem, $gBitSmarty;
$gProduct = new Product();
/* Process the input parameters this page accepts */
if (!empty($_REQUEST['product_id'])) {
    $gBitSmarty->assign_by_ref('gProductId', $_REQUEST['product_id']);
}
if (!empty($_REQUEST['client_id'])) {
    $gBitSmarty->assign_by_ref('gClientId', $_REQUEST['client_id']);
}
$productList = $gProduct->getList($_REQUEST);
// Pagination Data
$gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
$gBitSmarty->assign('productList', $productList);
// Display the template
$gDefaultCenter = "bitpackage:warehouse/list_products.tpl";
$gBitSmarty->assign_by_ref('gDefaultCenter', $gDefaultCenter);
$gBitSystem->display('bitpackage:kernel/dynamic.tpl', 'List Product Descriptions', array('display_mode' => 'list'));
Example #7
0
if (!isset($issue_fields_display['percent_complete']) || $issue_fields_display['percent_complete'] != false) {
    $columns[0][] = array('title' => ev_gettext('Percentage Complete'), 'data' => (empty($details['iss_percent_complete']) ? 0 : $details['iss_percent_complete']) . '%', 'field' => 'percentage_complete');
}
$columns[0][] = array('title' => ev_gettext('Reporter'), 'field' => 'reporter');
$products = Product::getAssocList(false);
if (count($products) > 0) {
    $columns[0][] = array('title' => ev_gettext('Product'), 'field' => 'product');
    $columns[0][] = array('title' => ev_gettext('Product Version'), 'field' => 'product_version');
}
$columns[0][] = array('title' => ev_gettext('Assignment'), 'data' => $details['assignments'], 'field' => 'assignment');
$columns[1][] = array('title' => ev_gettext('Notification List'), 'field' => 'notification_list');
$columns[1][] = array('title' => ev_gettext('Submitted Date'), 'data' => $details['iss_created_date']);
$columns[1][] = array('title' => ev_gettext('Last Updated Date'), 'data' => $details['iss_updated_date']);
$columns[1][] = array('title' => ev_gettext('Associated Issues'), 'field' => 'associated_issues');
if (!isset($issue_fields_display['expected_resolution']) || $issue_fields_display['expected_resolution'] != false) {
    $columns[1][] = array('title' => ev_gettext('Expected Resolution Date'), 'field' => 'expected_resolution');
}
if (!isset($issue_fields_display['estimated_dev_time']) || $issue_fields_display['estimated_dev_time'] != false) {
    $columns[1][] = array('title' => ev_gettext('Estimated Dev. Time'), 'data' => $details['iss_dev_time'] . empty($details['iss_dev_time']) ? '' : ' hours', 'field' => 'estimated_dev_time');
}
if ($role_id > User::getRoleID('Customer')) {
    $columns[1][] = array('title' => ev_gettext('Duplicates'), 'field' => 'duplicates', 'title_bgcolor' => APP_INTERNAL_COLOR);
    $columns[1][] = array('title' => ev_gettext('Authorized Repliers'), 'field' => 'authorized_repliers', 'title_bgcolor' => APP_INTERNAL_COLOR);
}
$groups = Group::getAssocList($prj_id);
if ($role_id > User::getRoleID('Customer') && count($groups) > 0) {
    $columns[1][] = array('title' => ev_gettext('Group'), 'data' => isset($details['group']) ? $details['group']['grp_name'] : '', 'title_bgcolor' => APP_INTERNAL_COLOR);
}
$tpl->assign(array('subscribers' => Notification::getSubscribers($issue_id), 'categories' => $categories, 'priorities' => $priorities, 'severities' => $severities, 'status' => $statuses, 'releases' => $releases, 'resolutions' => Resolution::getAssocList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'one_week_ts' => time() + 7 * Date_Helper::DAY, 'groups' => Group::getAssocList($prj_id), 'current_year' => date('Y'), 'products' => Product::getList(false), 'grid' => $columns));
$tpl->assign('usr_role_id', User::getRoleByUser($usr_id, $prj_id));
$tpl->displayTemplate();
Example #8
0
<?php

require_once 'config/config.conf.php';
try {
    $id = !empty($_GET['id']) ? intval($_GET['id']) : 0;
    if (empty($id)) {
        throw new Exception('Undefined product id');
    }
    $bindings = array(':id' => $id);
    $product = Product::getById($id);
    if (empty($product)) {
        throw new Exception('Undefined product');
    }
    $bindings[':category'] = $product->getCategory();
    $related_products = Product::getList('SELECT * FROM product WHERE category = :category AND id != :id LIMIT 3', $bindings);
    $smarty = new Smarty();
    $tpl_vars = array('pages' => $pages, 'current_page' => $current_page, 'product' => $product, 'related_products' => $related_products);
    $smarty->assign($tpl_vars);
    $smarty->display('product.tpl');
} catch (Exception $e) {
    exit($e->getMessage());
}
Example #9
0
<?php

/**
 * Created by PhpStorm.
 * User: Hoan
 * Date: 10/29/2015
 * Time: 1:17 PM
 */
//Khởi động session
session_start();
//Kiểm tra nếu chưa đăng nhập thì quay về trang đăng nhập
if (!isset($_SESSION['user'])) {
    header('location:../user/login.php');
}
//Require các file cần thiết
require '../../config/Config.php';
require '../../models/Product.php';
$productModel = new Product();
$productList = $productModel->getList();
//Giao diện
require '../../views/product/v_list.php';