function hoursAwaitingApproval() { $currentTeam = getCurrentTeam(); if ($currentTeam == false) { drupal_set_message("You don't have a team assigned.", 'error'); return; } $TID = $currentTeam['TID']; $teamNumber = $currentTeam['number']; // create header $markup = ''; $markup .= '<h2>Hours Awaiting Approval</h2>'; $markup .= '<table class="infoTable"><tr>'; $markup .= '<th colspan="2">Outreach</th>'; $markup .= '<th colspan="2">User</th>'; $markup .= '<th colspan="2">Hours</th>'; $markup .= '<th colspan="2"></th>'; $markup .= "</tr>"; $filterParams = array('TID' => $TID, 'isApproved' => false); $hours = dbGetHours($filterParams); // if the team has unapproved hours if (!empty($hours)) { foreach ($hours as $hour) { $OID = $hour['OID']; $outreach = dbGetOutreach($OID); $UID = $hour["UID"]; $numHours = $hour['numberOfHours']; $HID = $hour['HID']; $markup .= "<tr>"; $markup .= '<td colspan="2">' . '<a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 20) . '</a>' . '</td>'; $markup .= '<td colspan="2">' . dbGetUserName($UID) . ' </td>'; $markup .= '<td colspan="2"><a href="?q=logHours&HID=' . $HID . '">' . $numHours . '</a></td>'; // approve or reject buttons if (canApproveHours($HID)) { $markup .= "<td colspan=\"2\"><a href=\"?q=approveHours/{$hour['HID']}\"><button>Approve</button></a>"; $markup .= "<a href=\"?q=deleteHours/{$HID}\">"; $markup .= '<button><img class="trashIcon" src="/images/icons/trashWhite.png"></button></a></td>'; } else { $markup .= '<td></td><td></td>'; } $markup .= "</tr>"; } } else { // display none if the team has no hours waiting approval $markup .= "<tr>"; $markup .= '<td style="text-align:center" colspan="8"><em>[None]</em></td>'; $markup .= "</tr>"; } $markup .= "</table>"; $retArray = array(); $retArray['#markup'] = $markup; return $retArray; }
function search($begriff) { global $db, $tree, $PMF_LANG, $PMF_CONF; $output = ""; $result = $db->search(SQLPREFIX . "faqdata", array(SQLPREFIX . "faqdata.id AS id", SQLPREFIX . "faqdata.lang AS lang", SQLPREFIX . "faqcategoryrelations.category_id AS category_id", SQLPREFIX . "faqdata.thema AS thema", SQLPREFIX . "faqdata.content AS content"), SQLPREFIX . "faqcategoryrelations", array(SQLPREFIX . "faqdata.id = " . SQLPREFIX . "faqcategoryrelations.record_id", SQLPREFIX . "faqdata.lang = " . SQLPREFIX . "faqcategoryrelations.record_lang"), array(SQLPREFIX . "faqdata.thema", SQLPREFIX . "faqdata.content", SQLPREFIX . "faqdata.keywords"), $begriff, array(SQLPREFIX . "faqdata.active" => "yes")); if ($db->num_rows($result) > 0) { $output .= $num . $PMF_LANG["msgSearchAmounts"] . "\n"; while ($row = $db->fetch_object($result)) { $rubriktext = $tree->categoryName[$row->rubrik]["name"]; $thema = chopString($row->thema, 15); $output .= htmlentities($rubriktext) . ";" . htmlentities($row->thema) . ";" . "http://" . $_SERVER['SERVER_NAME'] . str_replace("xmlrpc.php", "index.php", $_SERVER['PHP_SELF']) . "?action=artikel&cat=" . $row->category_id . "&id=" . $row->id . "&artlang=" . $row->lang . "\n"; } } else { $output = "No Articles found"; } return $output; }
function viewEventsForTeam() { global $user; $params = drupal_get_query_parameters(); if (dbGetTeamsForUser($user->uid) == NULL) { drupal_set_message("You don't have a team assigned.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); return; } if (isset($params['UID'])) { $UID = $params['UID']; } else { $UID = $user->uid; } if (isset($params['TID'])) { $TID = $params['TID']; } else { $currentTeam = getCurrentTeam(); $TID = $currentTeam['TID']; } $outreaches = dbGetOutreachesForUserForTeam($UID, $TID); $markup = '<div style="width:50%;align-text:right;"><h2>Outreaches You Have <b>Signed Up</b> For</h2></div>'; $markup .= '<table>'; $markup .= '<tr>'; $markup .= "<th>Name</th>"; $markup .= "<th>Description</th>"; $markup .= "<th>Hours</th>"; $markup .= "</tr>"; foreach ($outreaches as $outreach) { $markup .= "<tr>"; $markup .= "<td>" . '<b><a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 15) . '</a>' . "<b></td>"; $markup .= "<td>" . chopString($outreach["description"], 15) . "</td>"; $markup .= "<td>" . dbGetHoursForUserFromOutreach($UID, $outreach['OID']) . "</tr>"; $markup .= "</tr>"; } $markup .= "</table></div>"; $retArray = array(); $retArray['#markup'] = $markup; return $retArray; }
} $writeLetters = '<p>'; $result = $db->query($query_1); while ($row = $db->fetch_object($result)) { $letters = $row->letters; if (preg_match("/^[a-z0-9]/i", $letters)) { if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") { $writeLetters .= '<a href="sitemap-' . $letters . '_' . $lang . '.html">' . $letters . '</a> '; } else { $writeLetters .= '<a href="' . $_SERVER["PHP_SELF"] . '?' . $sids . 'action=sitemap&letter=' . $letters . '&lang=' . $lang . '">' . $letters . '</a> '; } } } $writeLetters .= '</p>'; $writeMap = '<ul>'; $result = $db->query($query_2); $oldId = 0; while ($row = $db->fetch_object($result)) { if ($oldId != $row->id) { if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") { $writeMap .= '<li><a href="' . $row->category_id . '_' . $row->id . '_' . $row->lang . '.html">' . PMF_htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset']) . "</a><br />\n"; } else { $writeMap .= '<li><a href="index.php?' . $sids . 'action=artikel&cat=' . $row->category_id . '&id=' . $row->id . '&artlang=' . $row->lang . '">' . PMF_htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset']) . "</a><br />\n"; } $writeMap .= chopString(strip_tags($row->snap), 25) . " ...</li>\n"; } $oldId = $row->id; } $writeMap .= '</ul>'; $tpl->processTemplate('writeContent', array('writeLetters' => $writeLetters, 'writeMap' => $writeMap, 'writeCuttentLetter' => $currentLetter)); $tpl->includeTemplate('writeContent', 'index');
function viewOutreach() { global $user; $UID = $user->uid; $params = drupal_get_query_parameters(); $markup = "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.js\"></script>"; $markup .= '<script src="numberCounting.js"></script>'; $markup .= '<h1>Outreach</h1><br>'; // if doing a custom search if (isset($params['query']) && $params['query'] == 'search') { $sql = generateSearchSQL($_SESSION['searchParams'], $_SESSION['proxyFields']); $outreaches = dbSearchOutreach($sql, $_SESSION['proxyFields']); $header = '<h2>Custom Search Results ('; $header .= empty($outreaches) ? '0' : count($outreaches); $header .= ' matches)</h2>'; } else { if (isset($params['tag'])) { $_SESSION['searchParams'] = array('tags' => array($params['tag'])); $_SESSION['proxyFields'] = array(); $sql = generateSearchSQL($_SESSION['searchParams'], $_SESSION['proxyFields']); $outreaches = dbSearchOutreach($sql, $_SESSION['proxyFields']); $header = '<h2>Outreaches Tagged "' . dbGetTagName($params['tag']) . '"</h2>'; } else { if (isset($params['owned'])) { $outreaches = dbGetOwnedOutreachForUser($UID); $header = '<h2>Outreaches I Own</h2>'; } else { if (isset($params['signedUp'])) { $outreaches = dbGetOutreachForUser($UID); $header = '<h2>Outreaches I Am Signed Up For</h2>'; } else { if (isset($params['allTeamOutreach'])) { $TID = getCurrentTeam()['TID']; $_SESSION['searchParams'] = array('TID' => array('value' => $TID, 'matchType' => 'exact')); $_SESSION['proxyFields'] = array(':TID' => $TID); $sql = generateSearchSQL($_SESSION['searchParams'], $_SESSION['proxyFields']); $outreaches = dbSearchOutreach($sql, $_SESSION['proxyFields']); $teamName = dbGetTeamName($TID); $header = "<h2>All Outreach for {$teamName}</h2>"; } else { $_SESSION['searchParams'] = array(); $_SESSION['proxyFields'] = array(); $header = "<h2>No Search Selected</h2>"; } } } } } if (isset($_SESSION['searchParams']['teams']) && count($_SESSION['searchParams']['teams']) > 1) { $multipleTeamsInResult = true; } else { $multipleTeamsInResult = false; } $markup .= $header; // set $outreaches to an array rather than false (so that later functions don't have errors) if (empty($outreaches)) { $outreaches = array(); } $totalFilterOutreaches = count($outreaches); $totalFilterHours = 0; foreach ($outreaches as &$outreach) { $outreach['hours'] = dbGetHoursForOutreach($outreach['OID']); $totalFilterHours += $outreach['hours']; } unset($outreach); $sortParam = isset($params["sort"]) ? $params['sort'] : 'name'; $isAscending = isset($params['isAscending']) ? true : false; orderByValue($outreaches, $sortParam, $isAscending); // custom function (see helperFunctions.inc) $markup .= '<table style="margin:0px">'; $markup .= '<tr><td style="padding:0px; text-align:left"><b>Outreaches with Current Filters: </b><span class="countUp">' . $totalFilterOutreaches . '</span></td>'; $markup .= '<td style="padding:0px; text-align:right" align="right"><b>Hours with Current Filters: </b><span class="countUp">' . $totalFilterHours . '</span></td></tr>'; $markup .= '<tr><td style="padding:0px" align="left">Sort By: '; // remove special params (since they should not be added every time) unset($params['isAscending']); unset($params['sort']); $markup .= sortHeader($sortParam, $params, $isAscending, 'Name', 'name', 'outreach') . ' | '; $markup .= sortHeader($sortParam, $params, $isAscending, 'Status', 'status', 'outreach') . ' | '; $markup .= sortHeader($sortParam, $params, $isAscending, 'Hours', 'hours', 'outreach') . ' | '; $markup .= sortHeader($sortParam, $params, $isAscending, 'Event Date', 'eventDate', 'outreach'); $markup .= '</td><td style="padding:0px; text-align:right">'; if (!isset($params['owned'])) { $markup .= '<a href="?q=outreach&owned"><div class="help tooltip4"><button>Owned</button><span id="helptext"; class="helptext tooltiptext4">Click here to sort by outreach you own.</span></div></a>'; } else { $markup .= '<a href="?q=outreach&allTeamOutreach"><button>All Team Outreach</button></a>'; } if (!isset($params['signedUp'])) { $markup .= '<a href="?q=outreach&signedUp"><div class="help tooltip3"><button>Signed Up</button><span id="helptext"; class="helptext tooltiptext3">Click here to sort by outreach you are signed up for.</span></div></a>'; } else { $markup .= '<a href="?q=outreach&allTeamOutreach"><button>All Team Outreach</button></a>'; } $markup .= '</td></tr></table>'; $markup .= '<table class="infoTable" style="margin:0px"><tr><th colspan="2">Status</th>'; if ($multipleTeamsInResult) { $markup .= '<th colspan="2">Team</th>'; } $markup .= '<th colspan="4">Name</th>'; $markup .= '<th colspan="2">Hours</th>'; $markup .= '<th colspan="2">Event Date</th>'; if (empty($outreaches)) { $markup .= '<tr><td colspan="11">No outreach found! Click <a href="?q=outreachForm">here</a> to create new outreach!</td></tr></table>'; return array('#markup' => $markup); } foreach ($outreaches as $outreach) { $OID = $outreach['OID']; $hours = dbGetHoursForOutreach($OID); $status; switch ($outreach['status']) { case 'isOutreach': $status = '<span title="Outreach Event"><img class="eventIndicatorIcon" src="/images/icons/outreachBlue.png"></span>'; break; case 'isIdea': $status = '<span title="Idea"><img class="eventIndicatorIcon" src="/images/icons/ideaBlue.png"></span>'; break; case 'doingWriteUp': $status = '<span title="Write Up"><img class="eventIndicatorIcon" src="/images/icons/writeUpBlue.png"></span> '; break; case 'locked': $status = '<span title="Locked Event"><img class="eventIndicatorIcon" src="/images/icons/lockedBlue.png"></span>'; break; default: drupal_set_message('Invalid outreach data.'); break; } $markup .= '<tr><td colspan="2" style="padding: 0px 0px 0px 14px;">'; $markup .= showOutreachStatusIcon($outreach['status']) . '</td>'; if ($multipleTeamsInResult) { $markup .= '<td colspan="2"><a href="?q=viewTeam&TID=' . $outreach['TID'] . '">' . dbGetTeamNumber($outreach['TID']) . '</a></td>'; } $markup .= '<td colspan="4"><a href="?q=viewOutreach&OID=' . $OID . '">' . chopString($outreach['name'], 15) . '</a></td>'; $markup .= '<td colspan="2">' . $hours . '</td>'; if (dbGetEarliestTimeForOutreach($OID) != false) { $markup .= '<td colspan="2">' . date(TIME_FORMAT, dbDateSQL2PHP(dbGetEarliestTimeForOutreach($OID))) . '</td>'; } else { $markup .= '<td colspan="2">[none]</td>'; } } $markup .= '</table>'; return array('#markup' => $markup); }
function viewUserOutreach() { global $user; $UID = $user->uid; $userName = dbGetUserName($UID); $params = drupal_get_query_parameters(); $currentYear = date("Y"); $totalFilterHours = 0; $markup = "<h1>All Outreach for {$userName}</h1>"; if (isset($params["cancelled"])) { $outreaches = dbGetCancelledOutreach($TID); } else { if (isset($params['query']) && $params['query'] == 'search') { $outreaches = dbSearchOutreach($_SESSION['searchSQL'], $_SESSION['proxyFields']); } else { $outreaches = dbGetOutreachesForTeam($TID); if (isset($params['status']) && $params['status'] != 'all') { $proxyFields = array(); $outreaches = dbSearchOutreach(generateSearchSQL(array('status' => array($params['status'])), $proxyFields), $proxyFields); } } } foreach ($outreaches as &$outreach) { $outreach['hours'] = dbGetHoursForOutreach($outreach['OID']); $totalFilterHours += $outreach['hours']; } unset($outreach); $markup .= '<div style="float:left"><h4>Hours With Current Filters: ' . $totalFilterHours . '</h4></div><br><br>'; $sortParam = isset($params["sort"]) ? $params['sort'] : 'name'; $statusParam = isset($params["status"]) ? $params['status'] : 'all'; orderByValue($outreaches, $sortParam, true); // custom function (see helperFunctions.inc) $markup .= '<div align="left" style="float: left">Sort By: '; switch ($sortParam) { case 'name': $markup .= '<b>Name</b><b> | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=status">Status</a><b> | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=hours">Hours</a><b> | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=logDate">Log Date</a><br>'; break; case 'status': $markup .= '<a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=name">Name</a><b> | </b><b>Status | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=hours">Hours</a><b> | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=logDate">Log Date</a><br>'; break; case 'hours': $markup .= '<a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=name">Name</a><b> | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=status">Status</a><b> | </b><b>Hours | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=logDate">Log Date</a><br>'; break; case 'logDate': $markup .= '<a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=name">Name</a><b> | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=status">Status</a><b> | </b><a href="?q=allTeamOutreach&status=' . $statusParam . '&sort=hours">Hours</a><b> | </b><b>Log Date</b><br>'; break; } $markup .= 'Include Status: '; switch ($statusParam) { case 'isIdea': $markup .= '<a href="?q=allTeamOutreach&sort=' . $sortParam . '">All</a><b> | </b><b>Idea | </b><a href="?q=allTeamOutreach&status=isOutreach&sort=' . $sortParam . '">Outreach</a><b> | </b><a href="?q=allTeamOutreach&status=doingWriteUp&sort=' . $sortParam . '">Write Up</a><br>'; break; case 'isOutreach': $markup .= '<a href="?q=allTeamOutreach&sort=' . $sortParam . '">All</a><b> | </b><a href="?q=allTeamOutreach&status=isIdea&sort=' . $sortParam . '">Idea</a><b> | </b><b>Outreach | </b><a href="?q=allTeamOutreach&status=doingWriteUp&sort=' . $sortParam . '">Write Up</a><br>'; break; case 'doingWriteUp': $markup .= '<a href="?q=allTeamOutreach&sort=' . $sortParam . '">All</a><b> | </b><a href="?q=allTeamOutreach&status=isIdea&sort=' . $sortParam . '">Idea</a><b> | </b><a href="?q=allTeamOutreach&status=isOutreach&sort=' . $sortParam . '">Outreach</a><b> | </b><b>Write Up</b><br>'; break; default: $markup .= '<b>All</b><b> | </b><a href="?q=allTeamOutreach&status=isIdea&sort=' . $sortParam . '">Idea</a><b> | </b><a href="?q=allTeamOutreach&status=isOutreach&sort=' . $sortParam . '">Outreach</a><b> | </b><a href="?q=allTeamOutreach&status=doingWriteUp&sort=' . $sortParam . '">Write Up</a><br>'; } $markup .= '</div>'; orderByValue($outreaches, $sortParam, true); // custom function (see helperFunctions.inc) // Begin Displaying Outreach Events $markup .= '<div align="right" style="float:right"><a href="?q=searchForm"><button>Search</button></a>'; if (!isset($params["cancelled"])) { $markup .= '<a href="?q=allTeamOutreach&cancelled"><button>Cancelled</button></a>'; } else { $markup .= '<a href="?q=allTeamOutreach"><button>All Outreaches</button></a>'; } $markup .= '<a href="?q=viewOutreachSettings"><button'; $markup .= dbGetRIDForTeam($user->uid, $TID) > 0 ? '' : ' disabled'; $markup .= '>Outreach Settings</button></a>'; $markup .= '</div><br>'; $markup .= '<table><tr><th>Name</th>'; $markup .= '<th>Description</th>'; $markup .= '<th>Status</th>'; $markup .= '<th>Hours</th>'; $markup .= '<th>Log Date</th>'; foreach ($outreaches as $outreach) { $hours = dbGetHoursForOutreach($outreach['OID']); $status; switch ($outreach['status']) { case 'isOutreach': $status = 'Outreach'; break; case 'isIdea': $status = 'Idea'; break; case 'doingWriteUp': $status = 'Write-Up'; break; default: $status = '[none]'; break; } $markup .= "<tr><td><a href='?q=viewOutreach&OID={$outreach['OID']}'>{$outreach['name']}</a></td>"; if (isset($outreach['description'])) { $markup .= "<td>" . chopString($outreach['description'], 50) . "</td>"; } else { $markup .= '<td>[none]</td>'; } $markup .= "<td>{$status}</td>"; $markup .= "<td>{$hours}</td>"; $eventDate = date(TIME_FORMAT, dbDateSQL2PHP($outreach['logDate'])); $markup .= "<td>{$eventDate}</td></tr>"; } $markup .= '</table>'; return array('#markup' => $markup); }
/** * This function returns all not expired records from one category * * @param int $category_id Category ID * @param string $orderby Order by * @param string $sortby Sorty by * @return array */ public function getAllRecordPerCategory($category_id, $orderby = 'id', $sortby = 'ASC') { global $sids; $faqdata = array(); if ($orderby == 'visits') { $current_table = 'fv'; } else { $current_table = 'fd'; } if ($this->groupSupport) { $permPart = sprintf("( fdg.group_id IN (%s)\n OR\n (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups)); } else { $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user); } $now = date('YmdHis'); $query = sprintf("\n SELECT\n fd.id AS id,\n fd.lang AS lang,\n fd.thema AS thema,\n fd.content AS record_content,\n fd.datum AS record_date,\n fcr.category_id AS category_id,\n fv.visits AS visits\n FROM\n %sfaqdata AS fd\n LEFT JOIN\n %sfaqcategoryrelations AS fcr\n ON\n fd.id = fcr.record_id\n AND\n fd.lang = fcr.record_lang\n LEFT JOIN\n %sfaqvisits AS fv\n ON\n fd.id = fv.id\n AND\n fv.lang = fd.lang\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.date_start <= '%s'\n AND\n fd.date_end >= '%s'\n AND\n fd.active = 'yes'\n AND\n fcr.category_id = %d\n AND\n fd.lang = '%s'\n AND\n %s\n ORDER BY\n %s.%s %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $now, $now, $category_id, $this->language, $permPart, $current_table, $this->db->escape_string($orderby), $this->db->escape_string($sortby)); $result = $this->db->query($query); $num = $this->db->num_rows($result); if ($num > 0) { while ($row = $this->db->fetch_object($result)) { if (empty($row->visits)) { $visits = 0; } else { $visits = $row->visits; } $title = PMF_htmlentities($row->thema, ENT_QUOTES, $this->pmf_lang['metaCharset']); $url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang); $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url); $oLink->itemTitle = $oLink->text = $oLink->tooltip = $row->thema; $faqdata[] = array('record_id' => $row->id, 'record_lang' => $row->lang, 'category_id' => $row->category_id, 'record_title' => $row->thema, 'record_preview' => chopString(strip_tags($row->record_content), 25), 'record_link' => $oLink->toString(), 'record_date' => $row->record_date, 'visits' => $visits); } } else { return $faqdata; } return $faqdata; }
/** * searchEngine() * * The main search function for the full text search * * @param string * @param string * @return string * @access public * @author Thorsten Rinne <*****@*****.**> * @since 2002-09-16 */ function searchEngine($begriff, $category = '%') { global $db, $sids, $tree, $PMF_LANG, $PMF_CONF; $_begriff = $begriff; $seite = ''; $output = ''; $searchItems = array(); if (isset($_REQUEST["seite"])) { $seite = $_REQUEST["seite"]; } else { $seite = 1; } if ('%' == $category) { $cond = array(SQLPREFIX . "faqdata.active" => "'yes'"); } else { $cond = array(SQLPREFIX . "faqdata.active" => "'yes'", SQLPREFIX . "faqcategoryrelations.category_id" => $category); } if (is_numeric($begriff)) { // search for the solution_id $result = $db->search(SQLPREFIX . 'faqdata', array(SQLPREFIX . 'faqdata.id AS id', SQLPREFIX . 'faqdata.lang AS lang', SQLPREFIX . 'faqdata.solution_id AS solution_id', SQLPREFIX . 'faqcategoryrelations.category_id AS category_id', SQLPREFIX . 'faqdata.thema AS thema', SQLPREFIX . 'faqdata.content AS content'), SQLPREFIX . 'faqcategoryrelations', array(SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqcategoryrelations.record_id', SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqcategoryrelations.record_lang'), array(SQLPREFIX . 'faqdata.solution_id'), $begriff, $cond); } else { $result = $db->search(SQLPREFIX . "faqdata", array(SQLPREFIX . "faqdata.id AS id", SQLPREFIX . "faqdata.lang AS lang", SQLPREFIX . "faqcategoryrelations.category_id AS category_id", SQLPREFIX . "faqdata.thema AS thema", SQLPREFIX . "faqdata.content AS content"), SQLPREFIX . "faqcategoryrelations", array(SQLPREFIX . "faqdata.id = " . SQLPREFIX . "faqcategoryrelations.record_id", SQLPREFIX . "faqdata.lang = " . SQLPREFIX . "faqcategoryrelations.record_lang"), array(SQLPREFIX . "faqdata.thema", SQLPREFIX . "faqdata.content", SQLPREFIX . "faqdata.keywords"), $begriff, $cond); } if (false === $result) { $output = $PMF_LANG['err_noArticles']; $num = 0; } else { $num = $db->num_rows($result); } // Show the record with the solution ID directly // Sanity checks: if a valid Solution ID has been provided the result set // will measure 1: this is true ONLY if the faq is not // classified among more than 1 category if (is_numeric($begriff) && $begriff > PMF_SOLUTION_ID_START_VALUE && $num > 0) { if (isset($PMF_CONF['mod_rewrite']) && $PMF_CONF['mod_rewrite'] == 'TRUE') { header('Location: http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . 'solution_id_' . $begriff . '.html'); } else { header('Location: http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . '?solution_id=' . $begriff); } exit; } if (0 == $num) { $keys = preg_split("/\\s+/", $begriff); $numKeys = count($keys); $where = ''; for ($i = 0; $i < $numKeys; $i++) { if (strlen($where) != 0) { $where = $where . " OR "; } $where = $where . '(' . SQLPREFIX . "faqdata.thema LIKE '%" . $keys[$i] . "%' OR " . SQLPREFIX . "faqdata.content LIKE '%" . $keys[$i] . "%' OR " . SQLPREFIX . "faqdata.keywords LIKE '%" . $keys[$i] . "%') AND " . SQLPREFIX . 'faqdata.active = \'yes\''; if (is_numeric($category)) { $where .= ' AND ' . SQLPREFIX . 'faqcategoryrelations.category_id = ' . $category; } } $where = " WHERE (" . $where . ") AND active = 'yes'"; $query = 'SELECT ' . SQLPREFIX . 'faqdata.id AS id, ' . SQLPREFIX . 'faqdata.lang AS lang, ' . SQLPREFIX . 'faqcategoryrelations.category_id AS category_id, ' . SQLPREFIX . 'faqdata.thema AS thema, ' . SQLPREFIX . 'faqdata.content AS content FROM ' . SQLPREFIX . 'faqdata LEFT JOIN ' . SQLPREFIX . 'faqcategoryrelations ON ' . SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqcategoryrelations.record_id AND ' . SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqcategoryrelations.record_lang ' . $where; $result = $db->query($query); $num = $db->num_rows($result); } $pages = ceil($num / $PMF_CONF["numRecordsPage"]); $last = $seite * $PMF_CONF["numRecordsPage"]; $first = $last - $PMF_CONF["numRecordsPage"]; if ($last > $num) { $last = $num; } if ($num > 0) { if ($num == "1") { $output .= "<p>" . $num . $PMF_LANG["msgSearchAmount"] . "</p>\n"; } else { $output .= "<p>" . $num . $PMF_LANG["msgSearchAmounts"] . "</p>\n"; } if ($pages > 1) { $output .= "<p><strong>" . $PMF_LANG["msgPage"] . $seite . " " . $PMF_LANG["msgVoteFrom"] . " " . $pages . " " . $PMF_LANG["msgPages"] . "</strong></p>"; } $output .= "<ul class=\"phpmyfaq_ul\">\n"; $counter = 0; $displayedCounter = 0; while (($row = $db->fetch_object($result)) && $displayedCounter < $PMF_CONF['numRecordsPage']) { $counter++; if ($counter <= $first) { continue; } $displayedCounter++; $rubriktext = $tree->getPath($row->category_id); $thema = PMF_htmlentities(chopString($row->thema, 15), ENT_NOQUOTES, $PMF_LANG['metaCharset']); $content = chopString(strip_tags($row->content), 25); $begriff = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']'), '', $begriff); $begriff = preg_quote($begriff, '/'); $searchItems = explode(' ', $begriff); if (strlen($searchItems[0]) > 1) { foreach ($searchItems as $item) { $thema = preg_replace_callback('/(' . $item . '="[^"]*")|((href|src|title|alt|class|style|id|name)="[^"]*' . $item . '[^"]*")|(' . $item . ')/mis', "highlight_no_links", $thema); $content = preg_replace_callback('/(' . $item . '="[^"]*")|((href|src|title|alt|class|style|id|name)="[^"]*' . $item . '[^"]*")|(' . $item . ')/mis', "highlight_no_links", $content); } } // Print the link to the faq record if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") { $output .= "<li><strong>" . $rubriktext . "</strong>: <a href=\"" . $row->category_id . "_" . $row->id . "_" . $row->lang . ".html?highlight=" . $begriff . "\">" . $thema . "...</a><br /><div class=\"searchpreview\"><strong>" . $PMF_LANG["msgSearchContent"] . "</strong> " . $content . "...</div><br /></li>\n"; } else { $output .= "<li><strong>" . $rubriktext . "</strong>: <a href=\"" . $_SERVER["PHP_SELF"] . "?" . $sids . "action=artikel&cat=" . $row->category_id . "&id=" . $row->id . "&artlang=" . $row->lang . "&highlight=" . $begriff . "\">" . $thema . "...</a><br /><div class=\"searchpreview\"><strong>" . $PMF_LANG["msgSearchContent"] . "</strong> " . $content . "...</div><br /></li>\n"; } } $output .= "</ul>\n"; } else { $output = $PMF_LANG["err_noArticles"]; } if ($num > $PMF_CONF["numRecordsPage"]) { $output .= "<p align=\"center\"><strong>"; $vor = $seite - 1; $next = $seite + 1; if ($vor != 0) { if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") { $output .= "[ <a href=\"search.html?search=" . urlencode($_begriff) . "&seite=" . $vor . "\">" . $PMF_LANG["msgPrevious"] . "</a> ]"; } else { $output .= "[ <a href=\"" . $_SERVER["PHP_SELF"] . "?" . $sids . "action=search&search=" . urlencode($_begriff) . "&seite=" . $vor . "\">" . $PMF_LANG["msgPrevious"] . "</a> ]"; } } $output .= " "; if ($next <= $pages) { if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") { $output .= "[ <a href=\"search.html?search=" . urlencode($_begriff) . "&seite=" . $next . "\">" . $PMF_LANG["msgNext"] . "</a> ]"; } else { $output .= "[ <a href=\"" . $_SERVER["PHP_SELF"] . "?" . $sids . "action=search&search=" . urlencode($_begriff) . "&seite=" . $next . "\">" . $PMF_LANG["msgNext"] . "</a> ]"; } } $output .= "</strong></p>"; } return $output; }
function writeUpsAwaitingApproval() { $currentTeam = getCurrentTeam(); if ($currentTeam == false) { drupal_set_message("You don't have a team assigned.", 'error'); return; } $TID = $currentTeam['TID']; $teamNumber = $currentTeam['number']; // create header $markup = '<h2>Write-Ups Awaiting Approval</h2>'; $markup .= '<table class="infoTable"><tr><th colspan="3">Name</th>'; $markup .= '<th colspan="2">Log Date</th>'; $markup .= '<th colspan="2">Owner</th>'; $markup .= '<th></th>'; $markup .= "</tr>"; // "true" indicates to only get write-ups that have been submitted $outreaches = dbGetWriteUpsForTeam($TID, true); // if the team has write-ups if (!empty($outreaches)) { $count = 0; foreach ($outreaches as $outreach) { $count++; $TID = $outreach['TID']; $team = dbGetTeam($outreach['TID']); $rawDate = $outreach['logDate']; $rawDate = dbDateSQL2PHP($rawDate); $logDate = date(TIME_FORMAT, $rawDate); $OID = $outreach['OID']; $owner = dbGetOutreachOwner($OID); $markup .= "<tr>"; $markup .= '<td colspan="3">' . '<a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 20) . '</a>' . '</td>'; $markup .= '<td colspan="2">' . $logDate . '</td>'; $markup .= '<td colspan="2">' . dbGetUserName($owner) . ' </td>'; // button to view the write up if (hasPermissionForTeam('approveIdeas', $TID)) { $markup .= '<td><a href="?q=writeupform&approving&OID=' . $OID . '"><button>View</button></a></td>'; } else { $markup .= '<td></td>'; } $markup .= "</tr>"; } // if the team doesn't have any write-ups } else { $markup .= "<tr>"; $markup .= '<td style="text-align:center" colspan="8"><em>[None]</em></td>'; $markup .= "</tr>"; } $markup .= "</table>"; $retArray = array(); $retArray['#markup'] = $markup; return $retArray; }
function recentTeamOutreach() { global $user; $UID = $user->uid; $params = drupal_get_query_parameters(); if (isset($params['TID'])) { $TID = $params['TID']; $team = dbGetTeam($TID); $teamNumber = $team['number']; } else { $team = getCurrentTeam(); $TID = $team['TID']; $team = dbGetTeam($TID); $teamNumber = $team['number']; } // checks to see if team can access page if (teamIsIneligible($TID)) { drupal_set_message('Your team does not have permission to access this page.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } // create header $markup = '<h1>Team Dashboard</h1><br>'; $markup .= '<h2>' . $team['number'] . ' Outreach</h2>'; $searchParams['teams'] = array($TID); $markup .= '<div align="left" style="float: left">Sort By: '; if (isset($params['sortByDate'])) { $outreaches = dbGetOutreachesForTeam($TID, 'upcoming', NUM_RECENT_OUTREACHES_SHOWN); $markup .= '<a href="?q=teamDashboard">Recently Added</a><b> | Upcoming Events</b></div>'; } else { $outreaches = dbGetOutreachesForTeam($TID, 'logDate', NUM_RECENT_OUTREACHES_SHOWN); $markup .= '<b>Recently Added | </b><a href="?q=teamDashboard&sortByDate">Upcoming Events</a></div>'; } $markup .= '<div align="right" style="float:right">'; // moderator page button if (!teamIsIneligible($TID) && hasPermissionForTeam('manageOutreachTags', $TID)) { $markup .= '<a href="?q=teamModeratorPage">'; $markup .= '<div class="help tooltip4">'; $markup .= '<button>Moderators</button>'; $markup .= '<span id="helptext"; class="helptext tooltiptext4">'; $markup .= 'Click here to view ideas, write-ups, and hours awaiting approval.'; $markup .= '</span></div></a>'; } else { $markup .= ''; } // all team outreach button $markup .= '<a href="?q=outreach&allTeamOutreach"><div class="help tooltip3"><button>All Team Outreach</button><span id="helptext"; class="helptext tooltiptext3">Click here to view all of your teams outreach.</span></div></a></div>'; // create table $markup .= '<table class="infoTable"><tr><th>Name</th><th>Event Date</th><th>Owner</th><th></th></tr>'; foreach ($outreaches as $outreach) { $OID = $outreach['OID']; $markup .= '<tr><td><a href="?q=viewOutreach&OID=' . $OID . '"</a>'; $markup .= chopString($outreach["name"], 20) . '</td>'; // displays event date if (dbGetEarliestTimeForOutreach($OID) != false) { $markup .= '<td>' . date(TIME_FORMAT, dbDateSQL2PHP(dbGetEarliestTimeForOutreach($OID))) . '</td>'; } else { $markup .= '<td>[none]</td>'; } $owner = dbGetOutreachOwner($OID); // displays outreach owner if ($owner != false) { $markup .= '<td><a href="?q=viewUser&UID=' . $owner . '">' . dbGetUserName($owner) . '</a></td>'; } else { $markup .= '<td>[none]</td>'; // insert placeholder if no outreach owner } $markup .= '<td>'; // sign up for outreach button $signUp = dbIsUserSignedUp($UID, $OID); if (dbIsUserSignedUp($UID, $OID)) { if (dbIsOutreachOver($OID)) { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><button type="button" disabled>Edit Sign Up</button></a>'; } else { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><button type="button">Edit Sign Up</button></div></a>'; } } else { if (dbIsOutreachOver($OID)) { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><button type="button" disabled>Sign Up</button></div></a>'; } else { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><button type="button">Sign Up</button></div></a>'; } } $markup .= '</td></tr>'; } // if no outreaches for team if (empty($outreaches)) { $markup .= '<tr><td colspan="10">No outreach found! Click <a href="?q=outreachForm">here</a> to create new outreach!</td></tr></table>'; return array('#markup' => $markup); } $markup .= '</table>'; return array('#markup' => $markup); }
function viewUserEventsForTeam() { global $user; $params = drupal_get_query_parameters(); // if user does not have a team if (dbGetTeamsForUser($user->uid) == NULL) { drupal_set_message("You don't have a team assigned.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } if (isset($params['UID'])) { $UID = $params['UID']; } else { $UID = $user->uid; } if (isset($params['TID'])) { $TID = $params['TID']; } else { $currentTeam = getCurrentTeam(); $TID = $currentTeam['TID']; } $outreaches = dbGetOutreachesForUserForTeam($UID, $TID); $teamName = dbGetTeamName($TID); // create page header and table $markup = "<table><h1>My Outreaches For {$teamName}</h1></table>"; $markup .= '<table class="infoTable">'; $markup .= '<tr>'; $markup .= '<th colspan="3">Outreach Name</th>'; $markup .= '<th colspan="3">Description</th>'; $markup .= '<th colspan="2">Hours</th>'; $markup .= "</tr>"; // if user has outreaches for the current team if (!empty($outreaches)) { foreach ($outreaches as $outreach) { $markup .= "<tr>"; $markup .= '<td colspan="3">' . '<a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 30) . '</a>' . "</td>"; $markup .= '<td colspan="3">' . chopString($outreach["description"], 30) . "</td>"; $markup .= '<td colspan="2">' . dbGetHoursForUserFromOutreach($UID, $outreach['OID']) . "</tr>"; $markup .= "</tr>"; } $markup .= "</table>"; } else { // if the user does not have any outreaches for the current team $markup .= '<tr><td style="text-align:center" colspan="10"><em>[None]</em></td>'; $markup .= "</tr>"; } $markup .= "</table>"; $retArray = array(); $retArray['#markup'] = $markup; return $retArray; }
/** * Returns all records from the current first letter * * @param string $letter Letter * @return array * @since 2007-03-30 * @author Thorsten Rinne <*****@*****.**> */ public function getRecordsFromLetter($letter = 'A') { global $sids, $PMF_LANG; if ($this->groupSupport) { $permPart = sprintf("( fdg.group_id IN (%s)\n OR\n (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups)); } else { $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user); } $letter = PMF_String::strtoupper($this->db->escapeString(PMF_String::substr($letter, 0, 1))); $writeMap = '<ul>'; switch ($this->type) { case 'db2': case 'sqlite': $query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTR(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart); break; default: $query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTRING(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart); break; } $result = $this->db->query($query); $oldId = 0; while ($row = $this->db->fetchObject($result)) { if ($oldId != $row->id) { $title = PMF_htmlentities($row->thema, ENT_QUOTES, 'utf-8'); $url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang); $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url); $oLink->itemTitle = $row->thema; $oLink->text = $title; $oLink->tooltip = $title; $writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n"; $writeMap .= chopString(strip_tags($row->snap), 25) . " ...</li>\n"; } $oldId = $row->id; } $writeMap .= '</ul>'; return $writeMap; }
function viewMedia() { global $user; if (dbGetTeamsForUser($user->uid) == false) { drupal_set_message("You don't have a team assigned.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } $params = drupal_get_query_parameters(); if (!isset($params['OID'])) { drupal_set_message('No outreach selected.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } $OID = $params['OID']; $markup = ''; $outreachName = dbGetOutreachName($OID); // create header, table $markup .= "<table><tr><td><h1>Media for \"{$outreachName}\" </h1></td>"; $markup .= '<td style="text-align:right">'; // upload media button $markup .= "<a href=\"?q=uploadMedia&OID={$OID}\"><button>Upload Media</button></a></td></tr></table>"; $media = dbGetMediaForOutreach($OID); // create table $markup .= '<table class="infoTable"><tr><th>Image</th><th>Name</th><th><Info</th><th>Uploaded By</th><th></th><th></th>'; // if media for outreach is not empty if (!empty($media)) { // displays all media for the outreach foreach ($media as $m) { $url = generateURL($m['FID']); $MID = $m['MID']; $UIDofMID = dbGetUserForMedia($MID); $profile = dbGetUserProfile($UIDofMID); $markup .= '<tr><td><a href=' . $url . '><img src="' . $url . '" width="150px" height="150px"></a></td>'; $markup .= '<td>' . $m['title'] . '</td>'; $markup .= '<td>' . wordwrap(chopString($m['description'], 30), 15, "<br>\n", TRUE) . '</td>'; $markup .= "<td>" . $profile['firstName'] . ' ' . $profile['lastName'] . "</td>"; $markup .= "<td><a href=\"?q=mediaForm&MID={$MID}&OID={$OID}\"><button><img class=\"editIcon\" src=\"/images/icons/editThumbnailWhite.png\"></button></a></td>"; // allow user to delete media if he/she was the one to upload it if (isMyMedia($MID)) { $markup .= "<td><a href=\"?q=removeMedia/{$MID}\"><button><img class=\"trashIcon\" src=\"/images/icons/trashWhite.png\"></button></a></td>"; } else { $markup .= "<td></td>"; } } $markup .= '</tr></table>'; } else { // if there is no media assigned to the outreach $markup .= "<tr>"; $markup .= '<td style="text-align:center" colspan="10"><em>[None]</em></td>'; $markup .= "</tr>"; } $markup .= "</table>"; return array('#markup' => $markup); }
/** * The main search function for the full text search * * TODO: add filter for (X)HTML tag names and attributes! * * @param string Text/Number (solution id) * @param string '%' to avoid any category filtering * @param boolean true to search over all languages * @param boolean true to disable the results paging * @param boolean true to use it for Instant Response * @return string * @access public * @author Thorsten Rinne <*****@*****.**> * @author Matteo Scaramuccia <*****@*****.**> * @author Adrianna Musiol <*****@*****.**> * @since 2002-09-16 */ function searchEngine($searchterm, $cat = '%', $allLanguages = true, $hasMore = false, $instantRespnse = false) { global $sids, $PMF_LANG, $plr, $LANGCODE, $faq, $current_user, $current_groups, $categoryLayout; $_searchterm = PMF_htmlentities(stripslashes($searchterm), ENT_QUOTES, 'utf-8'); $seite = 1; $output = ''; $num = 0; $searchItems = array(); $langs = true == $allLanguages ? '&langs=all' : ''; $seite = PMF_Filter::filterInput(INPUT_GET, 'seite', FILTER_VALIDATE_INT, 1); $db = PMF_Db::getInstance(); $faqconfig = PMF_Configuration::getInstance(); $result = getSearchData(htmlentities($searchterm, ENT_COMPAT, 'utf-8'), true, $cat, $allLanguages); $num = $db->numRows($result); if (0 == $num) { $output = $PMF_LANG['err_noArticles']; } $confPerPage = $faqconfig->get('main.numberOfRecordsPerPage'); $pages = ceil($num / $confPerPage); $last = $seite * $confPerPage; $first = $last - $confPerPage; if ($last > $num) { $last = $num; } if ($num > 0) { $output .= '<p>' . $plr->GetMsg('plmsgSearchAmount', $num); if ($hasMore && $pages > 1) { $output .= sprintf($PMF_LANG['msgInstantResponseMaxRecords'], $confPerPage); } $output .= "</p>\n"; if (!$hasMore && $pages > 1) { $output .= "<p><strong>" . $PMF_LANG["msgPage"] . $seite . " " . $PMF_LANG["msgVoteFrom"] . " " . $plr->GetMsg('plmsgPagesTotal', $pages) . "</strong></p>"; } $output .= "<ul class=\"phpmyfaq_ul\">\n"; $faqUser = new PMF_Faq_User(); $faqGroup = new PMF_Faq_Group(); $counter = $displayedCounter = 0; while (($row = $db->fetchObject($result)) && $displayedCounter < $confPerPage) { $counter++; if ($counter <= $first) { continue; } $displayedCounter++; $b_permission = false; //Groups Permission Check if ($faqconfig->get('main.permLevel') == 'medium') { $perm_group = $faqGroup->fetch($row->id); foreach ($current_groups as $value) { if ($value == $perm_group->group_id) { $b_permission = true; } } } if ($faqconfig->get('main.permLevel') == 'basic' || $b_permission) { $perm_user = $faqUser->fetch($row->id); foreach ($perm_user as $value) { if ($value == -1) { $b_permission = true; break; } elseif ((int) $value == $current_user) { $b_permission = true; break; } else { $b_permission = false; } } } if ($b_permission) { $rubriktext = $categoryLayout->renderBreadcrumb(array($row->category_id)); $thema = chopString($row->thema, 15); $content = chopString(strip_tags($row->content), 25); $searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $searchterm); $searchterm = preg_quote($searchterm, '/'); $searchItems = explode(' ', $searchterm); if (PMF_String::strlen($searchItems[0]) > 1) { foreach ($searchItems as $item) { if (PMF_String::strlen($item) > 2) { $thema = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $thema); $content = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $content); } } } // Print the link to the faq record $url = sprintf('?%saction=artikel&cat=%d&id=%d&artlang=%s&highlight=%s', $sids, $row->category_id, $row->id, $row->lang, urlencode($_searchterm)); if ($instantRespnse) { $currentUrl = PMF_Link::getSystemRelativeUri('ajaxresponse.php') . 'index.php'; } else { $currentUrl = PMF_Link::getSystemRelativeUri(); } $oLink = new PMF_Link($currentUrl . $url); $oLink->itemTitle = $row->thema; $oLink->text = $thema; $oLink->tooltip = $row->thema; $output .= '<li><strong>' . $rubriktext . '</strong>: ' . $oLink->toHtmlAnchor() . '<br />' . '<div class="searchpreview"><strong>' . $PMF_LANG['msgSearchContent'] . '</strong> ' . $content . '...</div>' . '<br /></li>' . "\n"; } } $output .= "</ul>\n"; } else { $output = $PMF_LANG["err_noArticles"]; } if (!$hasMore && $num > $confPerPage) { if ($faqconfig->get('main.enableRewriteRules')) { $baseUrl = sprintf("search.html?search=%s&seite=%d%s&searchcategory=%d", urlencode($_searchterm), $seite, $langs, $cat); } else { $baseUrl = PMF_Link::getSystemRelativeUri() . '?' . (empty($sids) ? '' : "{$sids}&") . 'action=search&search=' . urlencode($_searchterm) . '&seite=' . $seite . $langs . "&searchcategory=" . $cat; } $options = array('baseUrl' => $baseUrl, 'total' => $num, 'perPage' => $confPerPage, 'pageParamName' => 'seite', 'nextPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG["msgNext"] . '</a>', 'prevPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG["msgPrevious"] . '</a>', 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>'); $pagination = new PMF_Pagination($options); $output .= $pagination->render(); } return $output; }
function viewUserUpcomingEvents() { global $user; $UID = $user->uid; $currentTeam = getCurrentTeam(); $TID = $currentTeam['TID']; $teamNumber = $currentTeam['number']; $markup = '<div class="help tooltip2">'; $markup .= '<h2>My Upcoming Events</h2>'; $markup .= '<span id="helptext"; class="helptext tooltiptext2">'; $markup .= 'These are your upcoming events that you own or have signed up for.'; $markup .= '</span></div>'; $markup .= '<table class="infoTable"><tr><th colspan="3">Name</th>'; $markup .= '<th colspan="2">Event Date</th>'; if (dbUserMoreThan1Team($UID)) { // if the user has more than one team $markup .= '<th>Team</th>'; } else { $markup .= '<th></th>'; } $markup .= '<th></th>'; $markup .= "</tr>"; $orderParams = 'upcoming'; $outreaches = dbGetOutreachForUser($user->uid, $orderParams, NUM_UPCOMING_OUTREACHES_SHOWN); // if the user has upcoming outreaches if (!empty($outreaches)) { foreach ($outreaches as $outreach) { $OID = $outreach['OID']; $TID = $outreach['TID']; $team = dbGetTeam($outreach['TID']); $eventDate = date(TIME_FORMAT, strtotime(dbGetEarliestTimeForOutreach($OID))); // display outreach information $markup .= "<tr>"; $markup .= '<td colspan="3">' . '<a href="?q=viewOutreach&OID=' . $OID . '">' . chopString($outreach["name"], 20) . '</a>' . "</td>"; $markup .= '<td colspan="2">' . $eventDate . "</td>"; $markup .= "<td>{$team['number']}</td>"; $markup .= '<td><a href="?q=signUp&OID=' . $OID . '">'; $markup .= '<button type="button">Edit Sign Up</button></a></td>'; $markup .= "</tr>"; } } else { // if the user does not have any upcoming events $markup .= "<tr>"; $markup .= '<td style="text-align:center" colspan="7"><em>[None]</em></td>'; $markup .= "</tr>"; } $markup .= "</table>"; $retArray = array(); $retArray['#markup'] = $markup; return $retArray; }