function datesub($dateFormat = 'none', $format = "S") { if ($dateFormat == 'none') { $smartModuleConfig =& sf_getModuleConfig(); $dateFormat = $smartModuleConfig['dateformat']; } return formatTimestamp($this->getVar('datesub', $format), $dateFormat); }
function b_faqs_recent_show($options) { include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php"; $myts =& MyTextSanitizer::getInstance(); $smartModule =& sf_getModuleInfo(); $smartModuleConfig =& sf_getModuleConfig(); $block = array(); if ($options[0] == 0) { $categoryid = -1; } else { $categoryid = $options[0]; } $sort = $options[1]; $limit = $options[2]; $maxQuestionLength = $options[3]; // Creating the faq handler object $faq_handler =& sf_gethandler('faq'); // Creating the category handler object $category_handler =& sf_gethandler('category'); // Creating the last FAQs $faqsObj = $faq_handler->getAllPublished($limit, 0, $categoryid, $sort); $allcategories = $category_handler->getObjects(null, true); if ($faqsObj) { $userids = array(); foreach ($faqsObj as $key => $thisfaq) { $faqids[] = $thisfaq->getVar('faqid'); $userids[$thisfaq->uid()] = 1; } $answer_handler =& sf_gethandler('answer'); $allanswers = $answer_handler->getLastPublishedByFaq($faqids); foreach ($allanswers as $key => $thisanswer) { $userids[$thisanswer->uid()] = 1; } $member_handler =& xoops_gethandler('member'); $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($userids)) . ")", "IN"), true); for ($i = 0; $i < count($faqsObj); $i++) { $faqs['categoryid'] = $faqsObj[$i]->categoryid(); $faqs['question'] = $faqsObj[$i]->question($maxQuestionLength); $faqs['faqid'] = $faqsObj[$i]->faqid(); $faqs['categoryname'] = $allcategories[$faqsObj[$i]->categoryid()]->getVar('name'); // Creating the answer object $answerObj =& $allanswers[$faqsObj[$i]->faqid()]; $faqs['date'] = $faqsObj[$i]->datesub(); $faqs['poster'] = sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users); $block['faqs'][] = $faqs; } $block['lang_question'] = _MB_SF_FAQS; $block['lang_category'] = _MB_SF_CATEGORY; $block['lang_poster'] = _MB_SF_ANSWEREDBY; $block['lang_date'] = _MB_SF_DATE; $modulename = $myts->htmlSpecialChars($smartModule->getVar('name')); $block['lang_visitfaq'] = _MB_SF_VISITFAQ . " " . $modulename; } return $block; }
function sf_getHelpPath() { $smartConfig =& sf_getModuleConfig(); switch ($smartConfig['helppath_select']) { case 'docs.xoops.org': return 'http://docs.xoops.org/help/sfaqh/index.htm'; break; case 'inside': return XOOPS_URL . "/modules/smartfaq/doc/"; break; case 'custom': return $smartConfig['helppath_custom']; break; } }
function b_marquee_smartfaq($limit, $dateformat, $itemssize) { include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php"; $block = array(); $smartModule =& sf_getModuleInfo(); $smartModuleConfig =& sf_getModuleConfig(); $categoryid = -1; $sort = 'datesub'; if ($itemssize > 0) { $maxQuestionLength = $itemssize; } else { $maxQuestionLength = 99999; } // Creating the faq handler object $faq_handler =& sf_gethandler('faq'); // Creating the category handler object $category_handler =& sf_gethandler('category'); // Creating the last FAQs $faqsObj = $faq_handler->getAllPublished($limit, 0, $categoryid, $sort); $allcategories = $category_handler->getObjects(null, true); if ($faqsObj) { $userids = array(); foreach ($faqsObj as $key => $thisfaq) { $faqids[] = $thisfaq->getVar('faqid'); $userids[$thisfaq->uid()] = 1; } $answer_handler =& sf_gethandler('answer'); $allanswers = $answer_handler->getLastPublishedByFaq($faqids); foreach ($allanswers as $key => $thisanswer) { $userids[$thisanswer->uid()] = 1; } $member_handler =& xoops_gethandler('member'); $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($userids)) . ")", "IN"), true); for ($i = 0; $i < count($faqsObj); $i++) { $answerObj =& $allanswers[$faqsObj[$i]->faqid()]; $title = $faqsObj[$i]->question($maxQuestionLength); $block[] = array('date' => $faqsObj[$i]->datesub(), 'category' => $allcategories[$faqsObj[$i]->categoryid()]->getVar('name'), 'author' => sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqsObj[$i]->faqid() . "'>" . $title . '</a>'); } } return $block; }
function getWhoAndWhen($answerObj = null, $users = array()) { $smartModuleConfig = sf_getModuleConfig(); $requester = sf_getLinkedUnameFromId($this->uid(), $smartModuleConfig['userealname'], $users); $requestdate = $this->datesub(); if ($this->status() == _SF_STATUS_PUBLISHED || $this->status() == _SF_STATUS_NEW_ANSWER) { if ($answerObj == null) { $answerObj =& $this->answer(); } $submitdate = $answerObj->datesub(); if ($this->uid() == $answerObj->uid()) { $result = sprintf(_MD_SF_REQUESTEDANDANSWERED, $requester, $submitdate); } else { $submitter = sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users); $result = sprintf(_MD_SF_REQUESTEDBYANDANSWEREDBY, $requester, $submitter, $submitdate); } } else { $result = sprintf(_MD_SF_REQUESTEDBY, $requester, $requestdate); } return $result; }