本文整理汇总了PHP中xhelpGetHandler函数的典型用法代码示例。如果您正苦于以下问题:PHP xhelpGetHandler函数的具体用法?PHP xhelpGetHandler怎么用?PHP xhelpGetHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xhelpGetHandler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: removeDepts
function removeDepts()
{
global $xoopsDB;
//Needs force on delete
$hConfig =& xoops_gethandler('config');
// Select the config from the xoops_config table
$crit = new Criteria('conf_name', 'xhelp_defaultDept');
$config =& $hConfig->getConfigs($crit);
if (count($config) > 0) {
$xhelp_config = $config[0]->getVar('conf_id');
} else {
return false;
}
// Remove the config options
$hConfigOption =& xhelpGetHandler('configoption');
$crit = new Criteria('conf_id', $xhelp_config);
$configOptions =& $hConfigOption->getObjects($crit);
if (count($configOptions) > 0) {
foreach ($configOptions as $option) {
if (!$hConfigOption->deleteAll($option, true)) {
// Remove each config option
return false;
}
}
} else {
// If no config options were found
return $xhelp_config;
}
return $xhelp_config;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:30,代码来源:install.php
示例2: delete_ticket
/**
* Call Backback function for 'delete_ticket'
* @param xhelpTicket $ticket Ticket being deleted
* @return bool True on success, false on error
* @access public
*/
function delete_ticket($ticket)
{
$hStatus = xhelpGetHandler('status');
$status =& $hStatus->get($ticket->getVar('status'));
if ($status->getVar('state') == XHELP_STATE_UNRESOLVED) {
return $this->_clearPerfImages();
}
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:14,代码来源:cacheService.php
示例3: new_faq
/**
* Event: new_faq
* Triggered after FAQ addition
* @param xhelpTicket $ticket Ticket used as base for FAQ
* @param xhelpFaq $faq FAQ that was added
*/
function new_faq($ticket, $faq)
{
global $xoopsUser;
//Create a new solution from the supplied ticket / faq
$hTicketSol =& xhelpGetHandler('ticketSolution');
$sol =& $hTicketSol->create();
$sol->setVar('ticketid', $ticket->getVar('id'));
$sol->setVar('url', $faq->getVar('url'));
$sol->setVar('title', $faq->getVar('subject'));
$sol->setVar('uid', $xoopsUser->getVar('uid'));
return $hTicketSol->addSolution($ticket, $sol);
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:18,代码来源:firnService.php
示例4: staffByDept
function staffByDept($deptid)
{
$mc =& xhelpGetModuleConfig();
$field = $mc['xhelp_displayName'] == 1 ? 'uname' : 'name';
$deptid = intval($deptid);
$hMembership =& xhelpGetHandler('membership');
$staff =& $hMembership->xoopsUsersByDept($deptid);
$aStaff = array();
$aStaff[] = array('uid' => 0, 'name' => _XHELP_MESSAGE_NOOWNER);
foreach ($staff as $s) {
$aStaff[] = array('uid' => $s->getVar('uid'), 'name' => $s->getVar($field));
}
return $aStaff;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:14,代码来源:addTicketDeptChange.php
示例5: statusesByState
function statusesByState($state)
{
$state = intval($state);
$hStatus =& xhelpGetHandler('status');
if ($state == -1) {
// If select all is chosen
$statuses =& $hStatus->getObjects(null, true);
} else {
$statuses =& $hStatus->getStatusesByState($state);
}
$aStatuses = array();
$aStatuses[] = array('key' => -1, 'value' => _XHELP_TEXT_SELECT_ALL);
foreach ($statuses as $status) {
$aStatuses[] = array('key' => $status->getVar('id'), 'value' => $status->getVar('description'));
}
return $aStatuses;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:17,代码来源:changeSelectedState.php
示例6: array
/**
* getCategories: retrieve the categories for the module
* @return ARRAY Array of xhelpFaqCategory
*/
function &getCategories()
{
$ret = array();
// Create an instance of the xhelpFaqCategoryHandler
$hFaqCategory =& xhelpGetHandler('faqCategory');
// Get all the categories for the application
$hSmartCategory =& sf_gethandler('category');
$categories =& $hSmartCategory->getCategories(0, 0, -1);
//Convert the module specific category to the
//xhelpFaqCategory object for standarization
foreach ($categories as $category) {
$faqcat = $hFaqCategory->create();
$faqcat->setVar('id', $category->getVar('categoryid'));
$faqcat->setVar('parent', $category->getVar('parentid'));
$faqcat->setVar('name', $category->getVar('name'));
$ret[] = $faqcat;
}
unset($categories);
return $ret;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:24,代码来源:Smartfaq.php
示例7: array
/**
* @return array of xhelpFaqCategory objects
*/
function &getCategories()
{
global $xoopsDB;
$ret = array();
// Create an instance of the xhelpFaqCategoryHandler
$hFaqCategory =& xhelpGetHandler('faqCategory');
$sql = sprintf("SELECT cat_ID, cat_name, category_parent FROM %s", $xoopsDB->prefix("wp_categories"));
$result = $xoopsDB->query($sql);
if (!$result) {
return $ret;
}
//Convert the module specific category to the
//xhelpFaqCategory object for standarization
while ($myrow = $xoopsDB->fetchArray($result)) {
$faqcat = $hFaqCategory->create();
$faqcat->setVar('id', $myrow['cat_ID']);
$faqcat->setVar('name', $myrow['cat_name']);
$faqcat->setVar('parent', $myrow['category_parent']);
$ret[] = $faqcat;
}
return $ret;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:25,代码来源:wordpress.php
示例8: createTicket
/**
* Create a new ticket object
* @param object Reference to a {@link xhelpEmailParser} object
* @param object Current {@link xoopsUser} object
* @param object {@link xhelpDepartment} Ticket Department
* @param object {@link xhelpDepartmentEmailServer} Originating Email Server
* @return bool
* @access public
*/
function createTicket(&$mailParser, &$xoopsUser, &$department, &$server)
{
//get ticket handler
$hTicket =& xhelpGetHandler('ticket');
$ticket =& $hTicket->create();
//
$ticket->setVar('uid', $xoopsUser->uid());
$ticket->setVar('subject', $mailParser->getSubject());
$ticket->setVar('department', $department->getVar('id'));
$ticket->setVar('description', $mailParser->getBody());
$ticket->setVar('priority', 3);
$ticket->setVar('posted', time());
$ticket->setVar('userIP', _XHELP_EMAIL_SCANNER_IP_COLUMN);
$ticket->setVar('serverid', $server->getVar('id'));
$ticket->createEmailHash($mailParser->getEmail());
//
if ($hTicket->insert($ticket)) {
$this->_ticket = $ticket;
return true;
} else {
return false;
}
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:32,代码来源:ticketMailParser.php
示例9: addFaq_action
function addFaq_action()
{
global $xoopsUser, $_eventsrv;
$hTicket =& xhelpGetHandler('ticket');
// Retrieve ticket information
$ticketid = $_POST['ticketid'];
$ticket =& $hTicket->get($ticketid);
$adapter =& xhelpFaqAdapterFactory::getFaqAdapter();
$faq =& $adapter->createFaq();
// @todo - Make subject user editable
$faq->setVar('subject', $_POST['subject']);
$faq->setVar('problem', $_POST['problem']);
$faq->setVar('solution', $_POST['solution']);
// BTW - XOBJ_DTYPE_ARRAY vars must be serialized prior to calling setVar in XOOPS 2.0
$faq->setVar('categories', serialize($_POST['categories']));
if ($adapter->storeFaq($faq)) {
// Todo: Run events here
$_eventsrv->trigger('new_faq', array(&$ticket, &$faq));
redirect_header(XHELP_BASE_URL . "/ticket.php?id={$ticketid}", 3, _XHELP_MESSAGE_ADD_FAQ);
} else {
redirect_header(XHELP_BASE_URL . "/ticket.php?id={$ticketid}", 3, _XHELP_MESSAGE_ERR_ADD_FAQ);
}
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:23,代码来源:faq.php
示例10: rename
function rename($ticketid, $responseid = 0)
{
$ticketid = intval($ticketid);
$responseid = intval($responseid);
$old_ticketid = $this->getVar('ticketid');
$old_responseid = $this->getVar('responseid');
$filename = $this->getVar('filename');
if ($old_responseid != 0 && $responseid != 0) {
// Was a response and is going to be a response
$newFilename = str_replace("_" . $old_responseid . "_", "_" . $responseid . "_", $filename);
$newFilename = str_replace($old_ticketid . "_", $ticketid . "_", $newFilename);
} elseif ($old_responseid != 0 && $responseid == 0) {
// Was a response and is part of the ticket now
$newFilename = str_replace("_" . $old_responseid . "_", "_", $filename);
$newFilename = str_replace($old_ticketid . "_", $ticketid . "_", $newFilename);
} elseif ($old_responseid == 0 && $responseid != 0) {
// Was part of the ticket, now going to a response
$newFilename = str_replace($old_ticketid . "_", $ticketid . "_" . $responseid . "_", $filename);
} elseif ($old_responseid == 0 && $responseid == 0) {
// Was part of the ticket, and is part of the ticket now
$newFilename = str_replace($old_ticketid . "_", $ticketid . "_", $filename);
}
$hFile =& xhelpGetHandler('file');
$this->setVar('filename', $newFilename);
$this->setVar('ticketid', $ticketid);
$this->setVar('responseid', $responseid);
if ($hFile->insert($this, true)) {
$success = true;
} else {
$success = false;
}
$ret = false;
if ($success) {
$ret = $this->renameAtFS($filename, $newFilename);
}
return $ret;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:37,代码来源:file.php
示例11: xhelpTicketValues
/**
* Class Constructor
*
* @param mixed $ticketid null for a new object, hash table for an existing object
* @return none
* @access public
*/
function xhelpTicketValues($id = null)
{
$this->initVar('ticketid', XOBJ_DTYPE_INT, null, false);
$hFields =& xhelpGetHandler('ticketField');
$fields =& $hFields->getObjects(null, true);
foreach ($fields as $field) {
$key = $field->getVar('fieldname');
$datatype = $this->_getDataType($field->getVar('datatype'), $field->getVar('controltype'));
$value = $this->_getValueFromXoopsDataType($datatype);
$required = $field->getVar('required');
$maxlength = $field->getVar('fieldlength') < 50 ? $field->getVar('fieldlength') : 50;
$options = '';
$this->initVar($key, $datatype, null, $required, $maxlength, $options);
$this->_fields[$key] = $field->getVar('datatype') == _XHELP_DATATYPE_TEXT ? "%s" : "%d";
}
$this->_fields['ticketid'] = "%u";
if (isset($id)) {
if (is_array($id)) {
$this->assignVars($id);
}
} else {
$this->setNew();
}
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:ticketValues.php
示例12: testMailbox
function testMailbox()
{
$hDeptServers =& xhelpGetHandler('departmentMailBox');
$server = $hDeptServers->create();
$server->setVar('emailaddress', $_POST['emailaddress']);
$server->setVar('server', $_POST['server']);
$server->setVar('serverport', $_POST['port']);
$server->setVar('username', $_POST['username']);
$server->setVar('password', $_POST['password']);
$server->setVar('priority', $_POST['priority']);
echo "<html>";
echo "<head>";
echo "<link rel='stylesheet' type='text/css' media'screen' href='" . XOOPS_URL . "/xoops.css' />\r\n <link rel='stylesheet' type='text/css' media='screen' href='" . xoops_getcss() . "' />\r\n <link rel='stylesheet' type='text/css' media='screen' href='" . XOOPS_URL . "/modules/system/style.css' />";
echo "</head>";
echo "<body>";
echo "<table style='margin:0; padding:0;' class='outer'>";
if (@$server->connect()) {
//Connection Succeeded
echo "<tr><td class='head'>Connection Successful!</td></tr>";
} else {
//Connection Failed
echo "<tr class='head'><td>Connection Failed!</td></tr>";
echo "<tr class='even'><td>" . $server->getHtmlErrors() . "</td></tr>";
}
echo "</table>";
echo "</body>";
echo "</html>";
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:28,代码来源:department.php
示例13: reference
/** get a reference from the database.
@return array reference( category_id => ...., content => ....)
@param string id
*/
function getReference($doc_id)
{
$hTicket = xhelpGetHandler('ticket');
$ticket = $hTicket->get($doc_id);
$ref = array();
if (!$ticket) {
return $ref;
}
$ref['id'] = $ticket->getVar('ticketid');
$ref['content'] = $ticket->getVar('subject') . "\r\n" . $ticket->getVar('description');
$ref['category_id'] = 'P' . $ticket->getVar('ticketid');
return $ref;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:18,代码来源:xhelpNaiveBayesian.php
示例14: xhelpGetHandler
$hTicket =& xhelpGetHandler('ticket');
if (isset($_POST['ticketid'])) {
$xhelp_id = $_POST['ticketid'];
}
$ticketInfo =& $hTicket->get($xhelp_id);
// Retrieve ticket information
if ($hTicket->delete(&$ticketInfo)) {
$message = _XHELP_MESSAGE_DELETE_TICKET;
$_eventsrv->trigger('delete_ticket', array(&$ticketInfo));
} else {
$message = _XHELP_MESSAGE_DELETE_TICKET_ERROR;
}
redirect_header(XHELP_BASE_URL . '/index.php', 3, $message);
} elseif (isset($_POST['delete_responseTpl'])) {
//Should only the owner of a template be able to delete it?
$hResponseTpl = xhelpGetHandler('responseTemplates');
$displayTpl =& $hResponseTpl->get($_POST['tplID']);
if ($xoopsUser->getVar('uid') != $displayTpl->getVar('uid')) {
$message = _NOPERM;
} else {
if ($hResponseTpl->delete($displayTpl)) {
$message = _XHELP_MESSAGE_DELETE_RESPONSE_TPL;
$_eventsrv->trigger('delete_responseTpl', array($displayTpl));
} else {
$message = _XHELP_MESSAGE_DELETE_RESPONSE_TPL_ERROR;
}
}
redirect_header(XHELP_BASE_URL . "/profile.php", 3, $message);
}
} else {
// If not a user
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:delete.php
示例15: manageStatus
function manageStatus()
{
global $oAdminButton, $aSortBy, $aOrderBy, $aLimitBy, $order, $limit, $start, $sort;
$hStatus =& xhelpGetHandler('status');
if (isset($_POST['changeDefaultStatus'])) {
xhelpSetMeta("default_status", $_POST['default']);
}
if (isset($_POST['newStatus'])) {
if ($_POST['desc'] == '') {
// If no description supplied
$message = _AM_XHELP_MESSAGE_NO_DESC;
redirect_header(XHELP_ADMIN_URL . "/status.php?op=manageStatus", 3, $message);
}
$newStatus =& $hStatus->create();
$newStatus->setVar('state', intval($_POST['state']));
$newStatus->setVar('description', $_POST['desc']);
if ($hStatus->insert($newStatus)) {
header("Location: " . XHELP_ADMIN_URL . "/status.php?op=manageStatus");
} else {
$message = _AM_MESSAGE_ADD_STATUS_ERR;
redirect_header(XHELP_ADMIN_URL . "/status.php?op=manageStatus", 3, $message);
}
}
xoops_cp_header();
echo $oAdminButton->renderButtons('manStatus');
echo "<form method='post' action='" . XHELP_ADMIN_URL . "/status.php?op=manageStatus'>";
echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='2'><label>" . _AM_XHELP_TEXT_ADD_STATUS . "</label></th></tr>";
echo "<tr><td class='head' width='20%'>" . _AM_XHELP_TEXT_DESCRIPTION . "</td>\r\n <td class='even'>\r\n <input type='text' name='desc' value='' class='formButton' />\r\n </td>\r\n </tr>";
echo "<tr><td class='head' width='20%'>" . _AM_XHELP_TEXT_STATE . "</td><td class='even'>\r\n <select name='state'>\r\n <option value='1'>" . xhelpGetState(1) . "</option>\r\n <option value='2'>" . xhelpGetState(2) . "</option>\r\n </select></td></tr>";
echo "<tr><td class='foot' colspan='2'><input type='submit' name='newStatus' value='" . _AM_XHELP_TEXT_ADD_STATUS . "' class='formButton' /></td></tr>";
echo "</table></form>";
// Get list of existing statuses
$crit = new Criteria('', '');
$crit->setOrder($order);
$crit->setSort($sort);
$crit->setLimit($limit);
$crit->setStart($start);
$statuses =& $hStatus->getObjects($crit);
$total = $hStatus->getCount($crit);
$aStatuses = array();
foreach ($statuses as $status) {
$aStatuses[$status->getVar('id')] = $status->getVar('description');
}
if (!($default_status = xhelpGetMeta("default_status"))) {
xhelpSetMeta("default_status", "1");
$default_status = 1;
}
$form = new xhelpForm(_AM_XHELP_TEXT_DEFAULT_STATUS, 'default_status', xhelpMakeURI(XHELP_ADMIN_URL . '/status.php', array('op' => 'manageStatus')));
$status_select = new XoopsFormSelect(_AM_XHELP_TEXT_STATUS, 'default', $default_status);
$status_select->addOptionArray($aStatuses);
$btn_tray = new XoopsFormElementTray('');
$btn_tray->addElement(new XoopsFormButton('', 'changeDefaultStatus', _AM_XHELP_BUTTON_SUBMIT, 'submit'));
$form->addElement($status_select);
$form->addElement($btn_tray);
$form->setLabelWidth('20%');
echo $form->render();
$nav = new XoopsPageNav($total, $limit, $start, 'start', "op=manageStatus&limit={$limit}");
echo "<form action='" . XHELP_ADMIN_URL . "/status.php?op=manageStatus' style='margin:0; padding:0;' method='post'>";
echo "<table width='100%' cellspacing='1' class='outer'>";
echo "<tr><td align='right'>" . _AM_XHELP_TEXT_SORT_BY . "\r\n <select name='sort'>";
foreach ($aSortBy as $value => $text) {
$sort == $value ? $selected = "selected='selected'" : ($selected = '');
echo "<option value='{$value}' {$selected}>{$text}</option>";
}
echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_ORDER_BY . "\r\n <select name='order'>";
foreach ($aOrderBy as $value => $text) {
$order == $value ? $selected = "selected='selected'" : ($selected = '');
echo "<option value='{$value}' {$selected}>{$text}</option>";
}
echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_NUMBER_PER_PAGE . "\r\n <select name='limit'>";
foreach ($aLimitBy as $value => $text) {
$limit == $value ? $selected = "selected='selected'" : ($selected = '');
echo "<option value='{$value}' {$selected}>{$text}</option>";
}
echo "</select>\r\n <input type='submit' name='status_sort' id='status_sort' value='" . _AM_XHELP_BUTTON_SUBMIT . "' />\r\n </td>\r\n </tr>";
echo "</table></form>";
echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='4'><label>" . _AM_XHELP_TEXT_MANAGE_STATUSES . "</label></th></tr>";
echo "<tr class='head'>\r\n <td>" . _AM_XHELP_TEXT_ID . "</td>\r\n <td>" . _AM_XHELP_TEXT_DESCRIPTION . "</td>\r\n <td>" . _AM_XHELP_TEXT_STATE . "</td>\r\n <td>" . _AM_XHELP_TEXT_ACTIONS . "</td>\r\n </tr>";
foreach ($statuses as $status) {
echo "<tr class='even'><td>" . $status->getVar('id') . "</td><td>" . $status->getVar('description') . "</td>\r\n <td>" . xhelpGetState($status->getVar('state')) . "</td>\r\n <td>\r\n <a href='status.php?op=editStatus&statusid=" . $status->getVar('id') . "'><img src='" . XHELP_IMAGE_URL . "/button_edit.png' title='" . _AM_XHELP_TEXT_EDIT . "' name='editStatus' /></a> \r\n <a href='status.php?op=deleteStatus&statusid=" . $status->getVar('id') . "'><img src='" . XHELP_IMAGE_URL . "/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE . "' name='deleteStatus' /></a></td></tr>\r\n </td></tr>";
}
echo "</table>";
echo "<div id='status_nav'>" . $nav->renderNav() . "</div>";
xhelpAdminFooter();
xoops_cp_footer();
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:86,代码来源:status.php
示例16: upgradeDB
function upgradeDB()
{
global $xoopsModule, $oAdminButton;
$xoopsDB =& Database::getInstance();
//1. Determine previous release
// *** Update this in sql/mysql.sql for each release **
if (!xhelpTableExists('xhelp_meta')) {
$ver = '0.5';
} else {
if (!($ver = xhelpGetMeta('version'))) {
exit(_AM_XHELP_VERSION_ERR);
}
}
$hStaff =& xhelpGetHandler('staff');
$hMember =& xhelpGetHandler('membership');
$hTicket =& xhelpGetHandler('ticket');
$hXoopsMember =& xoops_gethandler('member');
$hRole =& xhelpGetHandler('role');
$mid = $xoopsModule->getVar('mid');
xoops_cp_header();
echo $oAdminButton->renderButtons('');
echo "<h2>" . _AM_XHELP_UPDATE_DB . "</h2>";
$ret = true;
//2. Do All Upgrades necessary to make current
// Break statements are omitted on purpose
switch ($ver) {
case '0.5':
set_time_limit(60);
printf("<h3>" . _AM_XHELP_UPDATE_TO . "</h3>", '0.6');
echo "<ul>";
//Create meta table
$ret = $ret && _runQuery(sprintf("CREATE TABLE %s (metakey varchar(50) NOT NULL default '', metavalue varchar(255) NOT NULL default '', PRIMARY KEY (metakey)) ENGINE=MyISAM;", $xoopsDB->prefix('xhelp_meta')), sprintf(_AM_XHELP_MSG_ADDTABLE, 'xhelp_meta'), sprintf(_AM_XHELP_MSG_ADDTABLE_ERR, 'xhelp_meta'));
//Insert Current Version into table
$qry = $xoopsDB->query(sprintf("INSERT INTO %s values('version', %s)", $xoopsDB->prefix('xhelp_meta'), $xoopsDB->quoteString($ver)));
//Update xhelp_responses table
$ret = $ret && _runQuery(sprintf("ALTER TABLE %s ADD private INT(11) NOT NULL DEFAULT '0'", $xoopsDB->prefix('xhelp_responses')), sprintf(_AM_XHELP_MSG_MODIFYTABLE, 'xhelp_responses'), sprintf(_AM_XHELP_MSG_MODIFYTABLE_ERR, 'xhelp_responses'));
//Retrieve uid's of all staff members
$qry = $xoopsDB->query('SELECT uid FROM ' . $xoopsDB->prefix('xhelp_staff') . ' ORDER BY uid');
//Get email addresses in user profile
$staff = array();
while ($arr = $xoopsDB->fetchArray($qry)) {
$staff[$arr['uid']] = '';
}
$xoopsDB->freeRecordSet($qry);
$query = 'SELECT uid, email FROM ' . $xoopsDB->prefix('users') . ' WHERE uid IN (' . implode(array_keys($staff), ',') . ')';
$qry = $xoopsDB->query($query);
while ($arr = $xoopsDB->fetchArray($qry)) {
$staff[$arr['uid']] = $arr['email'];
}
$xoopsDB->freeRecordSet($qry);
//Update xhelp_staff table
$ret = $ret && _runQuery(sprintf("ALTER TABLE %s ADD email varchar(255) NOT NULL default '' AFTER uid, ADD notify int(11) NOT NULL default '0'", $xoopsDB->prefix('xhelp_staff')), sprintf(_AM_XHELP_MSG_MODIFYTABLE, 'xhelp_staff'), sprintf(_AM_XHELP_MSG_MODIFYTABLE_ERR, 'xhelp_staff'));
//Update existing staff records
$staff_tbl = $xoopsDB->prefix('xhelp_staff');
$notif_tbl = $xoopsDB->prefix('xoopsnotifications');
$email_tpl = $xoopsModule->getInfo('_email_tpl');
foreach ($staff as $uid => $email) {
//get notifications for current user
$usernotif = 0;
$qry = $xoopsDB->query(sprintf("SELECT DISTINCT not_category, not_event FROM %s WHERE not_uid = %u AND not_category='dept' AND not_modid=%u", $notif_tbl, $uid, $mid));
while ($arr = $xoopsDB->fetchArray($qry)) {
//Look for current event information in $email_tpl
foreach ($email_tpl as $tpl) {
if ($tpl['name'] == $arr['not_event'] && $tpl['category'] == $arr['not_category']) {
$usernotif = $usernotif | pow(2, $tpl['bit_value']);
break;
}
}
}
//Update xhelp_staff with user notifications & email address
$ret = $ret && _runQuery(sprintf("UPDATE %s SET email = %s, notify = %u WHERE uid = %u", $staff_tbl, $xoopsDB->quoteString($email), $usernotif, $uid), sprintf(_AM_XHELP_MSG_UPDATESTAFF, $uid), sprintf(_AM_XHELP_MSG_UPDATESTAFF_ERR, $uid));
}
echo "</ul>";
case '0.6':
set_time_limit(60);
//Do DB updates to make 0.7
printf("<h3>" . _AM_XHELP_UPDATE_TO . "</h3>", '0.7');
echo "<ul>";
// change table names to lowercase
$ret = $ret && _renameTable('xhelp_logMessages', 'xhelp_logmessages');
$ret = $ret && _renameTable('xhelp_responseTemplates', 'xhelp_responsetemplates');
$ret = $ret && _renameTable('xhelp_jStaffDept', 'xhelp_jstaffdept');
$ret = $ret && _renameTable('xhelp_staffReview', 'xhelp_staffreview');
$ret = $ret && _renameTable('xhelp_emailTpl', 'xhelp_emailtpl');
// Remove unused table - xhelp_emailtpl
$ret = $ret && _runQuery(sprintf("DROP TABLE %s", $xoopsDB->prefix('xhelp_emailtpl')), sprintf(_AM_XHELP_MSG_REMOVE_TABLE, 'xhelp_emailtpl'), sprintf(_AM_XHELP_MSG_NOT_REMOVE_TABLE, 'xhelp_emailtpl'));
// xhelp_staff table - permTimestamp
$ret = $ret && _runQuery(sprintf("ALTER TABLE %s ADD permTimestamp INT(11) NOT NULL DEFAULT '0'", $xoopsDB->prefix('xhelp_staff')), sprintf(_AM_XHELP_MSG_MODIFYTABLE, 'xhelp_staff'), sprintf(_AM_XHELP_MSG_MODIFYTABLE_ERR, 'xhelp_staff'));
//Update xhelp_tickets table
$ret = $ret && _runQuery(sprintf("ALTER TABLE %s MODIFY subject VARCHAR(100) NOT NULL default ''", $xoopsDB->prefix('xhelp_tickets')), sprintf(_AM_XHELP_MSG_MODIFYTABLE, 'xhelp_tickets'), sprintf(_AM_XHELP_MSG_MODIFYTABLE_ERR, 'xhelp_tickets'));
$ret = $ret && _runQuery(sprintf("ALTER TABLE %s ADD (serverid INT(11) DEFAULT NULL,\r\n emailHash VARCHAR(100) DEFAULT NULL,\r\n email VARCHAR(100) DEFAULT NULL,\r\n overdueTime INT(11) NOT NULL DEFAULT '0',\r\n KEY emailHash (emailHash))", $xoopsDB->prefix('xhelp_tickets')), sprintf(_AM_XHELP_MSG_MODIFYTABLE, 'xhelp_tickets'), sprintf(_AM_XHELP_MSG_MODIFYTABLE_ERR, 'xhelp_tickets'));
// Create xhelp_department_mailbox table
$ret = $ret && _runQuery(sprintf("CREATE TABLE %s (id int(11) NOT NULL auto_increment,\r\n departmentid int(11) default NULL,\r\n emailaddress varchar(255) default NULL,\r\n server varchar(50) default NULL,\r\n serverport int(11) default NULL,\r\n username varchar(50) default NULL,\r\n password varchar(50) default NULL,\r\n priority tinyint(4) default NULL,\r\n mboxtype int(11) NOT NULL default 1,\r\n PRIMARY KEY (id),\r\n UNIQUE KEY id (id),\r\n KEY departmentid (departmentid),\r\n KEY emailaddress (emailaddress),\r\n KEY mboxtype (mboxtype)\r\n )ENGINE=MyISAM;", $xoopsDB->prefix('xhelp_department_mailbox')), sprintf(_AM_XHELP_MSG_ADDTABLE, 'xhelp_department_mailbox'), sprintf(_AM_XHELP_MSG_ADDTABLE_ERR, 'xhelp_department_mailbox'));
// Create xhelp_mailevent table
$ret = $ret && _runQuery(sprintf("CREATE TABLE %s (id int(11) NOT NULL auto_increment,\r\n mbox_id int(11) NOT NULL default '0',\r\n event_desc text,\r\n event_class int(11) NOT NULL default '0',\r\n posted int(11) NOT NULL default '0',\r\n PRIMARY KEY(id)\r\n )ENGINE=MyISAM;", $xoopsDB->prefix('xhelp_mailevent')), sprintf(_AM_XHELP_MSG_ADDTABLE, 'xhelp_mailevent'), sprintf(_AM_XHELP_MSG_ADDTABLE_ERR, 'xhelp_mailevent'));
// Create xhelp_roles table
$ret = $ret && _runQuery(sprintf("CREATE TABLE %s (id int(11) NOT NULL auto_increment,\r\n name varchar(35) NOT NULL default '',\r\n description mediumtext,\r\n tasks int(11) NOT NULL default '0',\r\n PRIMARY KEY(id)\r\n )ENGINE=MyISAM;", $xoopsDB->prefix('xhelp_roles')), sprintf(_AM_XHELP_MSG_ADDTABLE, 'xhelp_roles'), sprintf(_AM_XHELP_MSG_ADDTABLE_ERR, 'xhelp_roles'));
// Create xhelp_staffroles table
$ret = $ret && _runQuery(sprintf("CREATE TABLE %s (uid int(11) NOT NULL default '0',\r\n roleid int(11) NOT NULL default '0',\r\n deptid int(11) NOT NULL default '0',\r\n PRIMARY KEY(uid, roleid, deptid)\r\n )ENGINE=MyISAM;", $xoopsDB->prefix('xhelp_staffroles')), sprintf(_AM_XHELP_MSG_ADDTABLE, 'xhelp_staffroles'), sprintf(_AM_XHELP_MSG_ADDTABLE_ERR, 'xhelp_staffroles'));
// Add default roles to db
//.........这里部分代码省略.........
开发者ID:trabisdementia,项目名称:xuups,代码行数:101,代码来源:upgrade.php
示例17: xhelpGetHandler
function &_getTicketFields(&$ticket)
{
$hFieldDept =& xhelpGetHandler('ticketFieldDepartment');
$fields =& $hFieldDept->fieldsByDepartment($ticket->getVar('department'));
$values =& $ticket->getCustFieldValues(true);
foreach ($fields as $field) {
$_arr = $field->toArray();
$fieldname = $_arr['fieldname'];
$_arr['value'] = $values[$fieldname]['value'];
$_arr['fileid'] = $values[$fieldname]['fileid'];
$_arr['filename'] = $values[$fieldname]['filename'];
$ret[] = $_arr;
}
return $ret;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:15,代码来源:ticket.php
示例18: getStaffByTask
/**
* Retrieve array of all staff with permission for current task
*/
function getStaffByTask($task, $deptid = 0, $id_as_key = false)
{
$task = intval($task);
if (isset($deptid)) {
$deptid = intval($deptid);
}
// Get roles with $task value set
$hRoles =& xhelpGetHandler('role');
$roles =& $hRoles->getRolesByTask($task);
$aRoles = array();
foreach ($roles as $role) {
$aRoles[$role->getVar('id')] = '';
}
// Get staff roles by dept
$hStaffRole =& xhelpGetHandler('staffRole');
$crit = new CriteriaCompo(new Criteria('deptid', $deptid));
$crit->add(new Criteria('roleid', "(" . implode(array_keys($aRoles), ',') . ")", 'IN'));
unset($aRoles);
$staffRoles =& $hStaffRole->getObjects($crit);
$aStaffID = array();
foreach ($staffRoles as $sRole) {
$aStaffID[$sRole->getVar('uid')] = '';
}
// Get staff objects
$crit = new Criteria('uid', "(" . implode(array_keys($aStaffID), ',') . ")", 'IN');
$hStaff =& xhelpGetHandler('staff');
return $hStaff->getObjects($crit, $id_as_key);
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:staff.php
示例19: delete_staff
/**
* Event Handler for 'delete_staff' event
* @param xhelpStaff $staff Staff member being deleted
* @return bool True on success, false on error
* @access public
*/
function delete_staff($staff)
{
$hTicket =& xhelpGetHandler('ticket');
return $hTicket->updateAll('ownership', 0, new Criteria('ownership', $staff->getVar('uid')));
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:11,代码来源:staffService.php
示例20: delete
/**
* delete a ticket from the database
*
* @param object $obj reference to the {@link xhelpTicket} obj to delete
* @param bool $force
* @return bool FALSE if failed.
* @access public
*/
function delete(&$obj, $force = false)
{
if (strcasecmp($this->classname, get_class($obj)) != 0) {
return false;
}
// Remove all ticket responses first
$hResponses =& xhelpGetHandler('responses');
if (!$hResponses->deleteAll(new Criteria('ticketid', $obj->getVar('id')))) {
return false;
}
// Remove all files associated with this ticket
$hFiles =& xhelpGetHandler('file');
if (!$hFiles->deleteAll(new Criteria('ticketid', $obj->getVar('id')))) {
return false;
}
// Remove custom field values for this ticket
$hFieldValues =& xhelpGetHandler('ticketValues');
if (!$hFieldValues->deleteAll(new Criteria('ticketid', $obj->getVar('id')))) {
return false;
}
$ret = parent::delete($obj, $force);
return $ret;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:ticket.php
注:本文中的xhelpGetHandler函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论