Beispiel #1
0
 /**
  * Prepare array with all available insights pages
  *
  * @return array
  */
 public static function getInsightsPages()
 {
     global $wgEnableInsightsInfoboxes;
     if (!empty($wgEnableInsightsInfoboxes) && !isset(self::$insightsPages[InsightsUnconvertedInfoboxesModel::INSIGHT_TYPE])) {
         self::$insightsPages = array_merge([InsightsUnconvertedInfoboxesModel::INSIGHT_TYPE => 'InsightsUnconvertedInfoboxesModel'], self::$insightsPages);
     }
     return self::$insightsPages;
 }
 public function executeIndex($params)
 {
     wfProfileIn(__METHOD__);
     // add CSS for this module
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/InsightsModule.scss"));
     $this->themeClass = SassUtil::isThemeDark() ? 'insights-dark' : 'insights-light';
     $this->messageKeys = InsightsHelper::getMessageKeys();
     wfProfileOut(__METHOD__);
 }
 /**
  * Add insights param to edit page form to keep information about insights flow
  */
 public static function onGetLocalURL(Title $title, &$url, $query)
 {
     global $wgRequest;
     $subpage = $wgRequest->getVal('insights', null);
     if (InsightsHelper::isInsightPage($subpage)) {
         $action = $wgRequest->getVal('action', 'view');
         if ($action == 'edit' && $query == 'action=submit') {
             $url .= '&insights=' . $subpage;
         }
     }
     return true;
 }
 public function prepareData($res)
 {
     $data = [];
     $dbr = wfGetDB(DB_SLAVE);
     while ($row = $dbr->fetchObject($res)) {
         if ($row->title) {
             $article = [];
             $params = $this->getUrlParams();
             $title = Title::newFromText($row->title, $row->namespace);
             if ($title === null) {
                 continue;
             }
             $article['link'] = InsightsHelper::getTitleLink($title, $params);
             $article['metadata']['wantedBy'] = $this->makeWlhLink($title, $row);
             $data[] = $article;
         }
     }
     return $data;
 }
	<ul class="insights-nav-list">
		<?php 
foreach (InsightsHelper::getMessageKeys() as $key => $messages) {
    ?>
			<?php 
    $subpage == $key ? $class = 'active' : ($class = '');
    ?>
			<li class="insights-nav-item insights-icon-<?php 
    echo $key;
    ?>
 <?php 
    echo $class;
    ?>
">
				<a href="<?php 
    echo InsightsHelper::getSubpageLocalUrl($key);
    ?>
" class="insights-nav-link">
					<?php 
    echo wfMessage($messages['subtitle'])->escaped();
    ?>
				</a>
			</li>
		<?php 
}
?>
	</ul>
</div>
<div class="insights-container-main <?php 
echo $themeClass;
?>
 /**
  * Get params to generate link back to edit mode
  *
  * @param Title $title
  * @param InsightsModel $model
  */
 private function getInsightFixItParams(Title $title, InsightsModel $model)
 {
     $link = InsightsHelper::getTitleLink($title, $model->getUrlParams());
     return ['editPageText' => wfMessage('insights-notification-message-fixit')->plain(), 'editPageLink' => $link['url']];
 }
 /**
  * Get data for the next element that a user can take care of.
  *
  * @param string $type A key of a Querypage
  * @param string $articleName A title of an article
  * @return Array The next item's data
  */
 public function getNextItem($type, $articleName)
 {
     $next = [];
     $dbr = wfGetDB(DB_SLAVE);
     $articleName = $dbr->strencode($articleName);
     $res = $dbr->select('querycache', 'qc_title', ['qc_type' => ucfirst($type), "qc_title != '{$articleName}'"], 'DatabaseBase::select', ['LIMIT' => 1]);
     if ($res->numRows() > 0) {
         $row = $dbr->fetchObject($res);
         $title = Title::newFromText($row->qc_title);
         $next['link'] = InsightsHelper::getTitleLink($title, self::getUrlParams());
     }
     return $next;
 }