static public function updateShowAll( $notify_ids ) {
		wfProfileIn( 'SMWNotifyProcessor::updateShowAlls (SMW)' );

		$notifications = SMWNotifyProcessor::getNotifications();
		if ( $notifications == null || !is_array( $notifications ) ) {
			return wfMsg( 'smw_nm_proc_nonoti' );
		}
		$result = true;
		$idx = 0;
		$count = count( $notify_ids ) - 1;
		$sStore = NMStorage::getDatabase();
		foreach ( $notifications as $row ) {
			if ( ( $idx < $count ) && ( $notify_ids[$idx] == $row['notify_id'] ) ) {
				if ( $row['show_all'] == 0 ) {
					$result = $sStore->updateNotifyShowAll( $row['notify_id'], 1 );
				}
				$idx ++;
			} else {
				if ( $row['show_all'] == 1 ) {
					$result = $sStore->updateNotifyShowAll( $row['notify_id'], 0 );
				}
			}
			if ( !$result ) break;
		}

		wfProfileOut( 'SMWNotifyProcessor::updateStates (SMW)' );
		return $result ? wfMsg( 'smw_nm_proc_showsucc' ) : wfMsg( 'smw_nm_proc_showerr' );
	}
Example #2
0
    private function getNotifyTable()
    {
        global $wgUser;
        $isSysop = in_array('sysop', $wgUser->getEffectiveGroups());
        $cols = 6;
        $html = '<table width="100%" class="smwtable" id="nmtable">
			<tr><th width="5%" onmouseover="Tip(\'' . wfMsg('smw_nm_special_tt_delete') . '\')">' . wfMsg('smw_nm_special_delete') . '</th>
				<th width="20%" onmouseover="Tip(\'' . wfMsg('smw_nm_special_tt_name') . '\')">' . wfMsg('smw_nm_special_name') . '</th>
				<th width="40%" onmouseover="Tip(\'' . wfMsg('smw_nm_special_tt_query') . '\')" nowrap>' . wfMsg('smw_nm_special_query') . '</th>
				<th width="5%" onmouseover="Tip(\'' . wfMsg('smw_nm_special_tt_report') . '\')" nowrap>' . wfMsg('smw_nm_special_report') . '</th>
				<th width="5%" onmouseover="Tip(\'' . wfMsg('smw_nm_special_tt_show') . '\')" nowrap>' . wfMsg('smw_nm_special_show') . '</th>
				<th width="5%" onmouseover="Tip(\'' . wfMsg('smw_nm_special_tt_enable') . '\')">' . wfMsg('smw_nm_special_enable') . '</th>';
        if ($isSysop) {
            $cols++;
            $html .= '<th width="20%" onmouseover="Tip(\'' . wfMsg('smw_nm_special_tt_delegate') . '\')">' . wfMsg('smw_nm_special_delegate') . '</th>';
        }
        $html .= '</tr>';
        $notifications = SMWNotifyProcessor::getNotifications();
        if ($notifications != null) {
            foreach ($notifications as $row) {
                $html .= '<tr>
					<td><input type="checkbox" name="nmdel" value=' . $row['notify_id'] . '></td>
					<td><a target="_blank" href="' . $this->getTitle()->getFullURL('feed=rss&nid=' . $row['notify_id']) . '">' . $row['name'] . '</a></td>
					<td>' . str_replace("\n", "<br/>", $row['query']) . '</td>
					<td><input type="checkbox" ' . ($row['rep_all'] ? 'checked' : '') . ' name="nmall" value=' . $row['notify_id'] . '></td>
					<td><input type="checkbox" ' . ($row['show_all'] ? 'checked' : '') . ' name="nmsall" value=' . $row['notify_id'] . '></td>
					<td><input type="checkbox" ' . ($row['enable'] ? 'checked' : '') . ' name="nmenable" id="nmenable_' . $row['notify_id'] . '" value=' . $row['notify_id'] . '></td>';
                if ($isSysop) {
                    $html .= '<td><input type="text" name="nmdelegate" id=nmd_' . $row['notify_id'] . ' value="' . $row['delegate'] . '">
					<div class="page_name_auto_complete" id="nmdiv_' . $row['notify_id'] . '"></div></td>';
                }
                $html .= '</tr>';
            }
        }
        $html .= '<tr id="nmtoolbar">
					<td><a href="#" onclick="notifyhelper.delall(true)">' . wfMsg('smw_nm_special_all') . '</a>/<a href="#" onclick="notifyhelper.delall(false)">' . wfMsg('smw_nm_special_none') . '</a>&#160; <button class="btn" onclick="notifyhelper.deleteNotify()" onmouseover="this.className=\'btn btnhov\'; Tip(\'' . wfMsg('smw_nm_special_tt_delupdate') . '\')" onmouseout="this.className=\'btn\'">' . wfMsg('smw_nm_special_update') . '</button></td>
					<td></td><td></td>
					<td><a href="#" onclick="notifyhelper.reportall(true)">' . wfMsg('smw_nm_special_all') . '</a>/<a href="#" onclick="notifyhelper.reportall(false)">' . wfMsg('smw_nm_special_none') . '</a>&#160; <button class="btn" onclick="notifyhelper.updateReportAll()" onmouseover="this.className=\'btn btnhov\'; Tip(\'' . wfMsg('smw_nm_special_tt_reportupdate') . '\')" onmouseout="this.className=\'btn\'">' . wfMsg('smw_nm_special_update') . '</button></td>
					<td><a href="#" onclick="notifyhelper.showall(true)">' . wfMsg('smw_nm_special_all') . '</a>/<a href="#" onclick="notifyhelper.showall(false)">' . wfMsg('smw_nm_special_none') . '</a>&#160; <button class="btn" onclick="notifyhelper.updateShowAll()" onmouseover="this.className=\'btn btnhov\'; Tip(\'' . wfMsg('smw_nm_special_tt_showupdate') . '\')" onmouseout="this.className=\'btn\'">' . wfMsg('smw_nm_special_update') . '</button></td>
					<td><a href="#" onclick="notifyhelper.enableall(true)">' . wfMsg('smw_nm_special_all') . '</a>/<a href="#" onclick="notifyhelper.enableall(false)">' . wfMsg('smw_nm_special_none') . '</a>&#160; <button class="btn" onclick="notifyhelper.updateStates()" onmouseover="this.className=\'btn btnhov\'; Tip(\'' . wfMsg('smw_nm_special_tt_enableupdate') . '\')" onmouseout="this.className=\'btn\'">' . wfMsg('smw_nm_special_update') . '</button></td>';
        if ($isSysop) {
            $html .= '<td><button class="btn" onclick="notifyhelper.updateDelegate()" onmouseover="this.className=\'btn btnhov\'; Tip(\'' . wfMsg('smw_nm_special_tt_delegateupdate') . '\')" onmouseout="this.className=\'btn\'">' . wfMsg('smw_nm_special_update') . '</button></td>';
        }
        $html .= '</tr></table>';
        return $html;
    }