/**
  * Class Constructor
  *
  * @access	public
  */
 function xhelpNotificationService()
 {
     global $xoopsConfig, $xoopsModule;
     $this->_ts =& MyTextSanitizer::getInstance();
     $this->_template_dir = $this->_getTemplateDir($xoopsConfig['language']);
     $this->_module =& xhelpGetModule();
     $this->_hStaff =& xhelpGetHandler('staff');
     $this->_hNotification =& xhelpGetHandler('notification');
     $this->_hStatus =& xhelpGetHandler('status');
     $this->init();
 }
Example #2
0
 function &getVisibleDepartments($uid)
 {
     $uid = intval($uid);
     $xoopsModule =& xhelpGetModule();
     $module_id = $xoopsModule->getVar('mid');
     $hMember =& xoops_gethandler('member');
     $groups =& $hMember->getGroupsByUser($uid);
     $group_string = "(" . implode(array_values($groups), ',') . ")";
     $sql = sprintf("SELECT d.* FROM %s d INNER JOIN %s g ON d.id = g.gperm_itemid WHERE g.gperm_name = '%s' AND g.gperm_modid = '%s' AND g.gperm_groupid IN %s", $this->_db->prefix('xhelp_departments'), $this->_db->prefix('group_permission'), _XHELP_GROUP_PERM_DEPT, $module_id, $group_string);
     $ret = $this->_db->query($sql);
     $arr = array();
     while ($temp = $this->_db->fetchArray($ret)) {
         $dept = $this->_hDept->create();
         $dept->assignVars($temp);
         $arr[$dept->getVar('id')] = $dept;
         unset($temp);
     }
     return $arr;
 }
Example #3
0
function b_xhelp_performance_show($options)
{
    global $xoopsUser, $xoopsDB;
    $dirname = 'xhelp';
    $block = array();
    if (!$xoopsUser) {
        return false;
    }
    //Determine if the GD library is installed
    $block['use_img'] = function_exists("imagecreatefrompng");
    $xoopsModule =& xhelpGetModule();
    if ($xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
        $sql = sprintf("SELECT COUNT(*) as TicketCount, d.department, d.id FROM %s t INNER JOIN %s d ON t.department = d.id  INNER JOIN %s s ON t.status = s.id WHERE s.state = 1 GROUP BY d.department, d.id ORDER BY d.department", $xoopsDB->prefix('xhelp_tickets'), $xoopsDB->prefix('xhelp_departments'), $xoopsDB->prefix('xhelp_status'));
    } else {
        $sql = sprintf("SELECT COUNT(*) as TicketCount, d.department, d.id FROM %s t INNER JOIN %s j on t.department = j.department INNER JOIN %s d ON t.department = d.id INNER JOIN %s s on t.status = s.id WHERE s.state = 1 AND j.uid = %u GROUP BY d.department, d.id", $xoopsDB->prefix('xhelp_tickets'), $xoopsDB->prefix('xhelp_jstaffdept'), $xoopsDB->prefix('xhelp_departments'), $xoopsDB->prefix('xhelp_status'), $xoopsUser->getVar('uid'));
    }
    $ret = $xoopsDB->query($sql);
    $depts = array();
    $max_open = 0;
    while ($myrow = $xoopsDB->fetchArray($ret)) {
        $max_open = max($max_open, $myrow['TicketCount']);
        $url = xhelpMakeURI(XHELP_BASE_URL . '/index.php', array('op' => 'staffViewAll', 'dept' => $myrow['id'], 'state' => 1));
        $depts[] = array('id' => $myrow['id'], 'tickets' => $myrow['TicketCount'], 'name' => $myrow['department'], 'url' => $url);
    }
    if (count($depts) == 0) {
        return false;
    }
    if ($block['use_img']) {
        //Retrieve the image path for each department
        for ($i = 0; $i < count($depts); $i++) {
            $depts[$i]['img'] = _xhelp_getDeptImg($depts[$i]['id'], $depts[$i]['tickets'], $max_open, $i);
        }
    }
    $block['departments'] = $depts;
    return $block;
}
Example #4
0
include_once XOOPS_ROOT_PATH . '/class/preload.php';
include_once XOOPS_ROOT_PATH . '/class/logger/xoopslogger.php';
include_once XOOPS_ROOT_PATH . '/class/module.textsanitizer.php';
include_once XOOPS_ROOT_PATH . '/class/database/databasefactory.php';
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
require_once XOOPS_ROOT_PATH . '/class/criteria.php';
require_once XOOPS_ROOT_PATH . '/class/xoopskernel.php';
$xoops = new xos_kernel_Xoops2();
$xoops->pathTranslation();
$xoopsLogger =& XoopsLogger::getInstance();
$xoopsLogger->startTime();
define('XOOPS_DB_PROXY', 1);
$xoopsDB =& XoopsDatabaseFactory::getDatabaseConnection();
//End of Xoops globals include
if (!defined('XHELP_CONSTANTS_INCLUDED')) {
    include_once XOOPS_ROOT_PATH . '/modules/xhelp/include/constants.php';
}
require_once XHELP_BASE_PATH . '/functions.php';
$module_handler =& xoops_gethandler('module');
$module =& $module_handler;
$config_handler =& xoops_gethandler('config');
$xoopsConfig =& $config_handler->getConfigsByCat(XOOPS_CONF);
xoops_loadLanguage('global');
$xoopsConfigUser = array();
$myConfigs =& $config_handler->getConfigs();
foreach ($myConfigs as $myConf) {
    $xoopsConfigUser[$myConf->getVar('conf_name')] = $myConf->getVar('conf_value');
}
$xoopsModule =& xhelpGetModule();
$xoopsModuleConfig =& xhelpGetModuleConfig();
xhelpIncludeLang('main');
Example #5
0
function xhelpCreateDepartmentVisibility()
{
    $hDepartments =& xhelpGetHandler('department');
    $hGroups =& xoops_gethandler('group');
    $hGroupPerm =& xoops_gethandler('groupperm');
    $xoopsModule =& xhelpGetModule();
    $module_id = $xoopsModule->getVar('mid');
    // Get array of all departments
    $departments =& $hDepartments->getObjects(null, true);
    // Get array of groups
    $groups =& $hGroups->getObjects(null, true);
    $aGroups = array();
    foreach ($groups as $group_id => $group) {
        $aGroups[$group_id] = $group->getVar('name');
    }
    foreach ($departments as $dept) {
        $deptID = $dept->getVar('id');
        // Remove old group permissions
        $crit = new CriteriaCompo(new Criteria('gperm_modid', $module_id));
        $crit->add(new Criteria('gperm_itemid', $deptID));
        $crit->add(new Criteria('gperm_name', _XHELP_GROUP_PERM_DEPT));
        $hGroupPerm->deleteAll($crit);
        foreach ($aGroups as $group => $group_name) {
            // Add new group permissions
            $hGroupPerm->addRight(_XHELP_GROUP_PERM_DEPT, $deptID, $group, $module_id);
        }
        // Todo: Possibly add text saying, "Visibility for Department x set"
    }
    return true;
}
Example #6
0
/**
 * Retrieve this modules configuration variables
 *
 * @return ARRAY Key = config variable name, Value = current value
 * @access public
 */
function &xhelpGetModuleConfig()
{
    static $_config;
    if (!isset($_config)) {
        $hModConfig =& xoops_gethandler('config');
        $_module =& xhelpGetModule();
        $_config =& $hModConfig->getConfigsByCat(0, $_module->getVar('mid'));
    }
    return $_config;
}
Example #7
0
         $staff =& $hMembership->xoopsUsersByDept($dept_id);
         $aOwnership = array();
         $aOwnership[0] = _XHELP_NO_OWNER;
         foreach ($staff as $stf) {
             $aOwnership[$stf->getVar('uid')] = $stf->getVar('uname');
         }
         $xoopsTpl->assign('xhelp_aOwnership', $aOwnership);
     } else {
         $xoopsTpl->assign('xhelp_aOwnership', false);
     }
 }
 $has_mimes = false;
 if ($xoopsModuleConfig['xhelp_allowUpload']) {
     // Get available mimetypes for file uploading
     $hMime =& xhelpGetHandler('mimetype');
     $xhelp =& xhelpGetModule();
     $mid = $xhelp->getVar('mid');
     if (!$xhelp_isStaff) {
         $crit = new Criteria('mime_user', 1);
     } else {
         $crit = new Criteria('mime_admin', 1);
     }
     $mimetypes =& $hMime->getObjects($crit);
     $mimes = '';
     foreach ($mimetypes as $mime) {
         if ($mimes == '') {
             $mimes = $mime->getVar('mime_ext');
         } else {
             $mimes .= ", " . $mime->getVar('mime_ext');
         }
     }