本文整理匯總了PHP中Survey::has方法的典型用法代碼示例。如果您正苦於以下問題:PHP Survey::has方法的具體用法?PHP Survey::has怎麽用?PHP Survey::has使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Survey
的用法示例。
在下文中一共展示了Survey::has方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Main method.
*
* @since 0.1
*
* @param string $arg
*/
public function execute($subPage)
{
if (!parent::execute($subPage)) {
return;
}
if (is_null($subPage) || trim($subPage) === '') {
$this->getOutput()->redirect(SpecialPage::getTitleFor('Surveys')->getLocalURL());
} else {
$subPage = trim($subPage);
if (Survey::has(array('name' => $subPage))) {
$survey = Survey::newFromName($subPage);
$this->displayNavigation(array(wfMsgExt('survey-navigation-edit', 'parseinline', $survey->getField('name')), wfMsgExt('survey-navigation-take', 'parseinline', $survey->getField('name')), wfMsgExt('survey-navigation-list', 'parseinline')));
$this->displayStats($survey);
} else {
$this->showError('surveys-surveystats-nosuchsurvey');
}
}
}
示例2: onArticleViewHeader
/**
* Hook to insert things into article headers.
*
* @since 0.1
*
* @param Article &$article
* @param boolean $outputDone
* @param boolean $useParserCache
*
* @return true
*/
public static function onArticleViewHeader(Article &$article, &$outputDone, &$useParserCache)
{
if (!Survey::has(array('enabled' => 1))) {
return true;
}
$surveys = Survey::select(array('id', 'namespaces', 'ratio', 'expiry', 'min_pages'), array('enabled' => 1, 'user_type' => Survey::getTypesForUser($GLOBALS['wgUser'])));
foreach ($surveys as $survey) {
if (count($survey->getField('namespaces')) == 0) {
$nsValid = true;
} else {
$nsValid = in_array($article->getTitle()->getNamespace(), $survey->getField('namespaces'));
}
if ($nsValid) {
$GLOBALS['wgOut']->addWikiText(Xml::element('survey', array('id' => $survey->getId(), 'ratio' => $survey->getField('ratio'), 'expiry' => $survey->getField('expiry'), 'min-pages' => $survey->getField('min_pages'))));
}
}
return true;
}