本文整理汇总了PHP中xhelpGetHandler函数的典型用法代码示例。如果您正苦于以下问题:PHP xhelpGetHandler函数的具体用法?PHP xhelpGetHandler怎么用?PHP xhelpGetHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xhelpGetHandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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;
}
示例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();
}
}
示例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>";
}
示例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;
}
示例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
示例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();
}