function enemyRound($state) { $state['history'][$state['rounds']++] = getHistory($state); $state = applyEffects($state); if (checkFinished($state)) { return; } //enemy attack $damage = $state['enemy']['damage'] - $state['player']['armor']; if ($damage < 1) { $damage = 1; } $state['player']['health'] -= $damage; if (checkFinished($state)) { return; } return playerRound($state); }
if ($history[$i]['message_id'] != '') { echo '<td>'; if ($history[$i]['type'] == 1) { echo '<a href="https://www.facebook.com/' . $history[$i]['message_id'] . '" target="_blank">' . $history[$i]['message_id'] . '</a>'; } else { echo '<a href="http://twitter.com/' . $history[$i]['name'] . '/status/' . $history[$i]['message_id'] . '" target="_blank">' . $history[$i]['message_id'] . '</a>'; } echo '</td>'; } else { echo '<td><font color="red">Error: </font>' . $history[$i]['result'] . '</td>'; } echo '<td>' . $history[$i]['created'] . '</td>'; echo '</tr>'; $tmpCreated = $history[$i]['created']; } ?> </tbody> </table> <?php $history = getHistory(array('type' => $type)); echo '<center>' . display_pagination(array('start' => $start, 'nb_display' => $nb_display, 'nbTotal' => count($history))) . '</center>'; ?> </div> </div> </div> <?php include_once 'include/presentation/footer.php';
} else { //get request if (isset($_GET['query'])) { $type = $_GET['query']; switch ($type) { case 'online': $out = online(); break; case 'online_doctors': $out = online_users(session::USER_DOCTOR); break; case 'online_users': $out = online_users(session::USER_REGULAR); break; case 'getHistory': $out = getHistory(); break; case 'getUpdates': $out = getUpdates(); break; default: setStatus($out, 'fail', 'invalid type.'); break; } } else { setStatus($out, 'fail', 'query not set.'); } } header('Content-type: text/plain'); echo json_encode($out, JSON_PRETTY_PRINT); function setStatus($out, $msg, $error = NULL)
<?php if (have_posts()) { while (have_posts()) { the_post(); the_content(); } } ?> </h1> </div> </div> <?php $counter = 0; ?> <?php foreach (getHistory() as $slide) { ?> <div class="item"> <!-- Set the first background image using inline CSS below. --> <div class="fill" style="background-image:url(<?php echo getHistoryImage($slide->ID); ?> );"></div> <div class="carousel-caption"> <h1 data-animation="animated slideInRight"><?php echo $slide->post_content; ?> </h1> </div> <h2 class="history-year" data-animation="animated slideInRight"><?php echo $slide->post_title;
$resultQuery = mysqli_query($link, "DELETE FROM gameuser WHERE gameid = " . mysqli_real_escape_string($link, $_GET['gameid']) . " AND userid = " . mysqli_real_escape_string($link, $_GET['userid']) . ";"); addHistory($_GET['gameid'], 'left game:' . $_GET['userid']); echo json_encode('user left game'); } else { echo json_encode('user not found in game'); } } } else { echo json_encode("userid and gameid must be set"); } } elseif ($action == 'getHistories') { $histories = getHistory(); echo json_encode($histories); } elseif ($action == 'getHistory') { if (isset($_GET['gameid'])) { $histories = getHistory($_GET['gameid']); echo json_encode($histories); } else { echo json_encode('gameid must be set'); } } elseif ($action == 'addHistory') { if (isset($_GET['gameid']) && isset($_GET['text'])) { $games = getGame($_GET['gameid']); if (count($games) == 0) { echo json_encode('Game not found'); } else { addHistory($_GET['gameid'], $_GET['text']); echo json_encode('history added'); } } else { echo json_encode('gameid and text must be set');
include "column.php"; echo "<h1>"; if ($pid == $uid) { echo "我"; } else { echo $pnickname; } echo "的主页</h1>"; echo "<div class='graycontent'>姓名:" . $pnickname . "<br/>"; if ($pschool != null) { echo "学校:" . $pschool; } echo "</div>"; include "visit_history.php"; insertHistory($uid, $pid); getHistory($pid); if ($pid != $uid) { echo "<form action='leavemessage.php' method='post'>"; /************************* 留言栏 *************************/ echo "<div style='margin-top:20px'>"; echo "<div class='input-text' style='display:inline;'><input type='text' name='leavemessage_content' /></div>"; echo "<input type='submit' value='留言' id='leavemessage_button' class='input-button'/>"; echo "</div>"; } echo "<input type='hidden' value={$pid} id='h_pid' />"; echo "<input type='hidden' value='{$pnickname}' id='h_pnickname' />"; echo "<input type='hidden' value='{$pschool}' id='h_pschool' />"; if ($pid != $uid) { echo "<span id='leavemessage_inform'></span></form>"; } else { include "viewmessage.php";
/** * Function to get Contact related Task & Event which have activity type Held, Completed or Deferred. * @param integer $id - contactid * returns related Task or Event record in array format */ function get_history($id) { global $log; $log->debug("Entering get_history(" . $id . ") method ..."); $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users'); $query = "SELECT vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.status\n\t\t\t, vtiger_activity.eventstatus,vtiger_activity.activitytype, vtiger_activity.date_start,\n\t\t\tvtiger_activity.due_date,vtiger_activity.time_start,vtiger_activity.time_end,\n\t\t\tvtiger_contactdetails.contactid, vtiger_contactdetails.firstname,\n\t\t\tvtiger_contactdetails.lastname, vtiger_crmentity.modifiedtime,\n\t\t\tvtiger_crmentity.createdtime, vtiger_crmentity.description,\n\t\t\tcase when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name\n\t\t\t\tfrom vtiger_activity\n\t\t\t\tinner join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid\n\t\t\t\tinner join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid\n\t\t\t\tinner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid\n\t\t\t\tleft join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid\n\t\t\t\tleft join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid\n\t\t\t\tleft join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\t\twhere (vtiger_activity.activitytype != 'Emails')\n\t\t\t\tand (vtiger_activity.status = 'Completed' or vtiger_activity.status = 'Deferred' or (vtiger_activity.eventstatus = 'Held' and vtiger_activity.eventstatus != ''))\n\t\t\t\tand vtiger_cntactivityrel.contactid=" . $id . " and vtiger_crmentity.deleted = 0"; //Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php $log->debug("Entering get_history method ..."); return getHistory('Contacts', $query, $id); }
/** * Function to get Account related Task & Event which have activity type Held, Completed or Deferred. * @param integer $id - accountid * returns related Task or Event record in array format * MSL */ function get_history($id) { global $log; $log->debug("Entering get_history(" . $id . ") method ..."); $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users'); $query = "SELECT vtiger_activity.activityid, vtiger_activity.subject,\n\t\t\tvtiger_activity.status, vtiger_activity.eventstatus,\n\t\t\tvtiger_activity.activitytype, vtiger_activity.date_start, vtiger_activity.due_date,\n\t\t\tvtiger_activity.time_start, vtiger_activity.time_end,\n\t\t\tvtiger_crmentity.modifiedtime, vtiger_crmentity.createdtime,\n\t\t\tvtiger_crmentity.description,case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name\n\t\t\tFROM vtiger_activity\n\t\t\tINNER JOIN vtiger_seactivityrel\n\t\t\t\tON vtiger_seactivityrel.activityid = vtiger_activity.activityid\n\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tLEFT JOIN vtiger_users\n\t\t\t\tON vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\tWHERE (vtiger_activity.activitytype != 'Emails')\n\t\t\tAND (vtiger_activity.status = 'Completed'\n\t\t\t\tOR vtiger_activity.status = 'Deferred'\n\t\t\t\tOR (vtiger_activity.eventstatus = 'Held'\n\t\t\t\t\tAND vtiger_activity.eventstatus != ''))\n\t\t\tAND vtiger_seactivityrel.crmid = " . $id . "\n\t\t\tAND vtiger_crmentity.deleted = 0"; //Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php $log->debug("Exiting get_history method ..."); return getHistory('Accounts', $query, $id); }
function executeRequest($historyID, $type = '', $action = '', $URL = '', $requestData = '', $timeout = '', $isPluginResponse = true, $callOpt = array()) { $responseProcessor = array(); $responseProcessor['plugins']['install'] = $responseProcessor['themes']['install'] = 'installPluginsThemes'; $responseProcessor['plugins']['manage'] = $responseProcessor['themes']['manage'] = 'managePluginsThemes'; $responseProcessor['plugins']['get'] = $responseProcessor['themes']['get'] = 'getPluginsThemes'; $responseProcessor['stats']['getStats'] = 'getStats'; $responseProcessor['PTC']['update'] = 'updateAll'; $responseProcessor['backup']['now'] = 'backup'; $responseProcessor['backup']['multiCallNow'] = 'backup'; $responseProcessor['backup']['restore'] = 'restoreBackup'; $responseProcessor['backup']['remove'] = 'removeBackup'; $responseProcessor['site']['add'] = 'addSite'; $responseProcessor['site']['readd'] = 'readdSite'; $responseProcessor['site']['maintain'] = 'iwpMaintenance'; $responseProcessor['site']['auto_updater_settings'] = 'editSite'; $responseProcessor['site']['remove'] = 'removeSite'; $responseProcessor['site']['backupTest'] = 'backupTest'; $responseProcessor['clientPlugin']['update'] = 'updateClient'; $responseProcessor['backup']['trigger'] = 'triggerRecheck'; $responseProcessor['cookie']['get'] = 'getCookie'; setHook('responseProcessors', $responseProcessor); $historyData = getHistory($historyID); $actionResponse = $responseProcessor[$historyData['type']][$historyData['action']]; if (manageClients::methodPreExists($actionResponse)) { manageClients::executePre($actionResponse, $historyID); $historyDataTemp = getHistory($historyID); if ($historyDataTemp['status'] != 'pending') { return false; } unset($historyDataTemp); } if (empty($type) || empty($action) || empty($URL) || empty($requestData)) { $historyRawDetails = DB::getRow("?:history_raw_details", "*", "historyID='" . $historyID . "'"); $requestData = unserialize(base64_decode($historyRawDetails['request'])); $historyData = getHistory($historyID); $type = $historyData['type']; $action = $historyData['action']; $URL = $historyData['URL']; $timeout = $historyData['timeout']; $isPluginResponse = $historyData['isPluginResponse']; $callOpt = @unserialize($historyData['callOpt']); } $siteID = $historyData['siteID']; $callOpt = buildCookie($callOpt, $siteID, $historyData); addNoCacheToURL($URL, $historyData); updateHistory(array('microtimeInitiated' => microtime(true), 'status' => 'running'), $historyID); $updateHistoryData = array(); list($rawResponseData, $updateHistoryData['microtimeStarted'], $updateHistoryData['microtimeEnded'], $curlInfo, $rawResponseHeader) = doCall($URL, $requestData, $timeout, $callOpt); DB::update("?:history_raw_details", array('response' => addslashes($rawResponseData), 'callInfo' => serialize($curlInfo)), "historyID = '" . $historyID . "'"); $cookie = extractCookie($rawResponseHeader); saveCookie($cookie, $siteID); $cURLErrors = new cURLErrors($curlInfo); if (!$cURLErrors->isOk()) { $updateHistoryAdditionalData = array(); $updateHistoryAdditionalData = $cURLErrors->getErrorDetails(); $updateHistoryData['status'] = $updateHistoryAdditionalData['status']; $updateHistoryData['error'] = $updateHistoryAdditionalData['error']; if (!isPluginResponse($rawResponseData)) { //sometimes 500 error with proper IWP Client Response, so if it not proper response continue set error and exit updateHistory($updateHistoryData, $historyID, $updateHistoryAdditionalData); return checkTriggerStatus(); } } if ($isPluginResponse) { //$isPluginResponse is set to true then expecting result should be pluginResponse //$siteID = DB::getField("?:history", "siteID", "historyID='".$historyID."'"); //commented:siteID fetched from $historyData['siteID']; //checking response is the plugin data if (!isPluginResponse($rawResponseData)) { //Checking the timeout //For left menu color codes. if ($type == 'stats' && $action == 'getStats') { DB::update("?:sites", array('connectionStatus' => '0'), "siteID = '" . $siteID . "'"); } $updateHistoryAdditionalData = array(); $updateHistoryAdditionalData['status'] = $updateHistoryData['status'] = 'error'; $updateHistoryAdditionalData['error'] = $updateHistoryData['error'] = 'main_plugin_connection_error'; $updateHistoryAdditionalData['errorMsg'] = 'IWP Client plugin connection error.'; updateHistory($updateHistoryData, $historyID, $updateHistoryAdditionalData); return checkTriggerStatus(); } else { if ($type == 'stats' && $action == 'getStats') { DB::update("?:sites", array('connectionStatus' => '1'), "siteID = '" . $siteID . "'"); } } removeResponseJunk($rawResponseData); $responseData = processCallReturn(unserialize(base64_decode($rawResponseData))); } else { $responseData = $rawResponseData; } $updateHistoryData['status'] = 'processingResponse'; updateHistory($updateHistoryData, $historyID); //handling reponseData below if (manageClients::methodResponseExists($actionResponse)) { manageClients::executeResponse($actionResponse, $historyID, $responseData); //call_user_func('manageClients::'.$funcName, $historyID, $responseData); $status = "completed"; $historyReponseStatus = Reg::get("historyResponseStatus"); if (isset($historyReponseStatus[$historyID])) { $status = $historyReponseStatus[$historyID]; } updateHistory(array('status' => $status), $historyID); return true; } else { updateHistory(array('status' => 'completed'), $historyID); echo '<br>no_response_processor'; return 'no_response_processor'; } }
$alert .= " <convert>#label=486<convert>"; $alert .= "</div>"; $alert .= "<div class=\"new_content_license\">"; $alert .= " <p><convert>#label=482<convert></p>"; $alert .= " <p><convert>#label=483<convert></p>"; $alert .= " <p><convert>#label=484<convert></p>"; $alert .= " <p><convert>#label=509<convert> : " . getLicensePicture(1) . "</p>"; $alert .= "</div>"; return $alert; } //Get the values to display : $locations = getLocation($category, $id); $topographies = getTopography($category, $id); $descriptions = getDescription($category, $id); $riggings = getRigging($category, $id); $histories = getHistory($category, $id); $bibliographies = getBibliography($category, $id); $comments = getComment($category, $id); //Printing options setup : $disabledOnlyAttribute = "disabled=\\\"disabled\\\" "; $checkedAttribute = "checked=\\\"checked\\\" "; $printLocations = $locations['Count'] > 0 ? "" : $disabledOnlyAttribute; $printDescriptions = $descriptions['Count'] > 0 ? "" : $disabledOnlyAttribute; $printRiggings = $riggings['Count'] > 0 ? "" : $disabledOnlyAttribute; $printTopographies = $topographies['Count'] > 0 ? "" : $disabledOnlyAttribute; $printHistories = $histories['Count'] > 0 ? "" : $disabledOnlyAttribute; $printBibliographies = $bibliographies['Count'] > 0 ? "" : $disabledOnlyAttribute; $printComments = $comments['Count'] > 0 ? "" : $disabledOnlyAttribute; $defaultProperties = ""; $defaultInput_area = ""; $defaultMap = "checked=\\\"checked\\\" ";
$sh->insert("shifts", $prods->getOutput()); } $tpl->insert("shifts", $sh->getOutput()); } foreach (dbConn::query("SELECT * FROM :prefix:shift WHERE plan = :0 ORDER BY fromDate ASC, toDate DESC", $plan['name']) as $r) { $sh = new template("admin/plan.edit.time"); $sh->insert("id", $r['shiftId']); $sh->insert("from", $r['fromDate']); $sh->insert("to", $r['toDate']); $tpl->insert("times", $sh->getOutput()); } $tpl->removeVariables(); echo $tpl->getOutput(); break; case "history": echo getHistory(0); break; case "newplan": $tpl = new template("admin/plan.create"); echo $tpl->getOutput(); break; case "email": $tpl = new template("admin/mail.container"); foreach (dbConn::query("SELECT * FROM :prefix:plan ORDER BY created DESC") as $r) { $tpl->insert("plans", template::create("admin/mail.plan", array("name" => $r['name']))); } foreach (dbConn::query("SELECT DISTINCT name, email FROM :prefix:worker ORDER BY name ASC") as $r) { $rec = new template("admin/mail.recipient"); $rec->insert("name", $r['name']); $rec->insert("address", $r['email']); foreach (dbConn::query("SELECT DISTINCT name FROM :prefix:plan", $r['name'], $r['email']) as $s) {
/** * Function to get Countries related Task & Event which have activity type Held, Completed or Deferred. * @param integer $id - countriesid * returns related Task or Event record in array format */ function get_history($id) { global $log; $log->debug("Entering get_history(" . $id . ") method ..."); $entityIds = $this->getRelatedContactsIds(); $entityIds = implode(',', $entityIds); $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users'); $query = "SELECT DISTINCT(vtiger_activity.activityid), vtiger_activity.subject, vtiger_activity.status, vtiger_activity.eventstatus,\n\t\t\t\tvtiger_activity.activitytype, vtiger_activity.date_start, vtiger_activity.due_date, vtiger_activity.time_start, vtiger_activity.time_end,\n\t\t\t\tvtiger_crmentity.modifiedtime, vtiger_crmentity.createdtime, vtiger_crmentity.description,\n\t\t\t\tcase when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name\n\t\t\t\tFROM vtiger_activity\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\t\t\tLEFT JOIN vtiger_seactivityrel ON vtiger_seactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\tLEFT JOIN vtiger_cntactivityrel ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\tLEFT JOIN vtiger_contactdetails ON vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid\n\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\t\tWHERE (vtiger_activity.activitytype != 'Emails')\n\t\t\t\tAND (vtiger_activity.status = 'Completed'\n\t\t\t\t\tOR vtiger_activity.status = 'Deferred'\n\t\t\t\t\tOR (vtiger_activity.eventstatus = 'Held' AND vtiger_activity.eventstatus != ''))\n\t\t\t\tAND vtiger_crmentity.deleted = 0 AND (vtiger_seactivityrel.crmid = {$id}"; if (!empty($entityIds)) { $query .= " OR vtiger_cntactivityrel.contactid IN (" . $entityIds . "))"; } else { $query .= ")"; } //Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php $log->debug("Exiting get_history method ..."); return getHistory('Countries', $query, $id); }
} } else { if ($_GET["hole"]) { $rep = getRAuftrag($_GET["hole"]); if (!$rep) { $msg = "Nicht gefunden"; } $mid = $rep["mid"]; } else { $rep = $_POST; } } $masch = getAllMaschine($mid); $kdnr = $rep["kdnr"] ? $rep["kdnr"] : $masch["customer_id"]; $firma = getFirmenStamm($kdnr); $hist = getHistory($mid); $t = new Template($base); $t->set_file(array("masch" => "repauftrag.tpl")); doHeader($t); if (!$rep["datum"]) { $rep["datum"] = date("d.m.Y"); } $t->set_block("masch", "History", "Block1"); if ($hist) { if ($rep['aid']) { $t->set_var(array(date => '', art => '', open => ' ', beschreibung => "<a href='repauftrag.php?mid={$mid}'>Neuer Auftrag</a>")); $t->parse("Block1", "History", true); } while ($zeile = array_shift($hist)) { $open = ' '; if ($zeile["art"] == "RepAuftr") {
/** * Process feeds * * @param array $feeds List of feeds to process * @param array $config Configuration array * @return array Processing stats */ function processFeeds($feeds, $config) { $result = array(); $shows = getShows($config); $excludes = getExcludes($config); foreach ($feeds as $feed) { $feedItems = getFeedItems($feed); $cleanItems = cleanFeedItems($feedItems, $shows, $excludes); $history = getHistory($config); foreach ($cleanItems as $d) { $entry = $d['show'] . " " . $d['episode']; if (!in_array($entry, $history)) { downloadTorrent($d['url'], $config); $history[] = $entry; $result[$feed][] = $entry; } } saveHistory($history, $config); } return $result; }
<div id="empfs"> <?php echo empInfo($empID); ?> </div> </fieldset> <hr /> <input type=submit value="Add Eval" id="addbutton" /> <div id="workspace"> </div> <fieldset><legend>History</legend> <div id="historyfs"> <?php echo getHistory($empID); ?> </div> </fieldset> <hr /> <input type=submit value="Add Comment" id="commentbutton" /> <div id="cform"> </div> <fieldset><legend>Comments</legend> <div id="commentfs"> <?php echo getComments($empID); ?> </div> </fieldset>
</tr> </thead> <tbody> <?php getRecords(); ?> </tbody> </table> </div> </div> <!-- 結果履歴 --> <div class="tab-pane" id="history_tab"> <div class="panel-group" id="accordion1"> <?php getHistory(); ?> </div> </div> <!-- 大会 --> <div class="tab-pane" id="competitions_tab"> <div class="panel-group" id="accordion2"> <?php getCompetitions(); ?> </div> </div> </div> </div>
<?php require_once "inc/stdLib.php"; include "inc/FirmenLib.php"; include "inc/wvLib.php"; include "inc/pdfpos.php"; define("FPDF_FONTPATH", "/usr/share/fpdf/font/"); define("FONTART", "2"); define("FONTSTYLE", "1"); $rep = getRAuftrag($_GET["aid"]); $masch = getAllMaschine($rep["mid"]); $firma = getFirmenStamm($masch["customer_id"]); $hist = getHistory($rep["mid"]); $material = getAllMat($_GET["aid"], $rep["mid"]); if ($material) { foreach ($material as $zeile) { $mat .= $zeile["menge"] . " x " . substr($zeile["description"], 0, 70) . "\n"; } } require "fpdf.php"; require "fpdi.php"; $pdf = new FPDI('P', 'mm', 'A4'); $seiten = $pdf->setSourceFile("vorlage/repauftrag.pdf"); $hdl = $pdf->ImportPage(1); $pdf->addPage(); $pdf->useTemplate($hdl); $pdf->SetFont($repfont, 'B', $repsizeL); $pdf->Text($repname[x], $repname[y], utf8_decode($firma["name"])); $pdf->Text($repstr[x], $repstr[y], utf8_decode($firma["street"])); $pdf->Text($report[x], $report[y], $firma["zipcode"] . " " . utf8_decode($firma["city"])); $pdf->Text($repphone[x], $repphone[y], $firma["phone"]);
/** Function to get the activities history associated with the Sales Order * This function accepts the id as arguments and execute the MySQL query using the id * and sends the query and the id as arguments to renderRelatedHistory() method */ function get_history($id) { global $log; $log->debug("Entering get_history(" . $id . ") method ..."); $userNameSql = getSqlForNameInDisplayFormat(array('f' => 'vtiger_users.first_name', 'l' => 'vtiger_users.last_name')); $query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, \r\n\t\t\tvtiger_contactdetails.contactid,vtiger_activity.*, vtiger_seactivityrel.*, \r\n\t\t\tvtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime,\t\r\n\t\t\tvtiger_crmentity.createdtime, vtiger_crmentity.description, case when \r\n\t\t\t(vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname \r\n\t\t\tend as user_name from vtiger_activity\r\n\t\t\t\tinner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid\r\n\t\t\t\tinner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid\r\n\t\t\t\tleft join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid\r\n\t\t\t\tleft join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid\r\n left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid\r\n\t\t\t\tleft join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid\r\n\t\t\twhere activitytype='Task'\r\n\t\t\t\tand (vtiger_activity.status = 'Completed' or vtiger_activity.status = 'Deferred')\r\n\t\t\t\tand vtiger_seactivityrel.crmid=" . $id . "\r\n and vtiger_crmentity.deleted = 0"; //Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php $log->debug("Exiting get_history method ..."); return getHistory('SalesOrder', $query, $id); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head profile="http://gmpg.org/xfn/11"> <title>Icecast Play Historyt</title> </head> <body> <p> Code by Jude (<a href="mailto:surftheair@gmail.com">surftheair@gmail.com</a>) </p> <pre> <?php include 'history.php'; $history = getHistory(date('Y-m-d')); print_r($history); ?> </pre> </body> </html>
/** function used to get the the activity history related to the quote * @param int $id - quote id * @return array - return an array which will be returned from the function GetHistory */ function get_history($id) { global $log; $log->debug("Entering get_history(" . $id . ") method ..."); $query = "SELECT vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.status,\n\t\t\tvtiger_activity.eventstatus, vtiger_activity.activitytype,vtiger_activity.date_start, \n\t\t\tvtiger_activity.due_date,vtiger_activity.time_start, vtiger_activity.time_end,\n\t\t\tvtiger_contactdetails.contactid,\n\t\t\tvtiger_contactdetails.firstname,vtiger_contactdetails.lastname, vtiger_crmentity.modifiedtime,\n\t\t\tvtiger_crmentity.createdtime, vtiger_crmentity.description, case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name\n\t\t\tfrom vtiger_activity\n\t\t\t\tinner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid\n\t\t\t\tinner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid\n\t\t\t\tleft join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid\n\t\t\t\tleft join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid\n left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid\n\t\t\t\tleft join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\t\twhere vtiger_activity.activitytype='Task'\n \t\t\t\tand (vtiger_activity.status = 'Completed' or vtiger_activity.status = 'Deferred')\n\t \t \tand vtiger_seactivityrel.crmid=" . $id . "\n and vtiger_crmentity.deleted = 0"; //Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php $log->debug("Exiting get_history method ..."); return getHistory('Quotes', $query, $id); }
$data = $data[0]; $hist = getHistory($data["id"]); $disp = ""; } else { if ($_POST["cnt"] && $_POST["mid"]) { $rc = updateCounter($_POST["counter"], $_POST["mid"]); $data = getSernumber($_POST["serialnumber"]); $data = $data[0]; $hist = getHistory($data["id"]); $disp = ""; } else { if ($_POST["idat"] && $_POST["mid"]) { $rc = updateIdat($_POST["inspdatum"], $_POST["mid"]); $data = getSernumber($_POST["serialnumber"]); $data = $data[0]; $hist = getHistory($data["id"]); $disp = ""; } } } } //$cnt=($data["mid"])?getCounter($data["mid"]):""; $t->set_file(array("masch" => "maschinen1.tpl")); doHeader($t); $t->set_var(array(action => "maschine1.php", msg => $msg, disp => $disp, parts_id => $data["id"], partnumber => $data["partnumber"], description => $data["description"], notes => strtr($data["notes"], array("\n" => "<br>")), standort => $data["standort"], serialnumber => $data["serialnumber"], contractnumber => $data["contractnumber"], inspdatum => db2date($data["inspdatum"]), counter => $data['counter'], cid => $data["cid"], mid => $data["mid"] ? $data["mid"] : $data["id"], customer => $data["name"], custid => $data["customer_id"])); $t->set_block("masch", "History", "Block1"); if ($hist) { foreach ($hist as $zeile) { $open = ' '; if ($zeile["art"] == "RepAuftr") { $open = $zeile['status'] == 2 ? 'close' : 'open';