public static function viewStudentProfile() { self::requireLogin(); $studentId = $_SESSION['_id']; $profile = toJSON(self::getStudentProfile($studentId)); self::render('jobs/student/studentprofile', ['profile' => $profile]); }
/** * Recursive function to parse nested dictionaries. * Un-nests input data and adds hierarchy level to every item. * * @param mixed $data Dictionary which holds menu entries (may contain subitems/-trees) * @param int $level Hierarchy level of the (sub)tree to start with * @return array An array of JSON objects */ function toJSON($data, $level = 0) { $tmp = array(); $index = 0; while ($index < count($data)) { $data[$index]['TITLE'] = str_replace("\\", "\\\\", $data[$index]['TITLE']); $data[$index]['TITLE'] = str_replace("\"", "\\\"", $data[$index]['TITLE']); $entry = '{id:' . $data[$index]['ID'] . ',level:' . $level . ',visible:' . $data[$index]['VISIBLE'] . ',hideChildren:0,text:"' . $data[$index]['TITLE'] . '",link:"' . $data[$index]['URL'] . '"}'; $tmp[] = $entry; if (count($data[$index]['SUBITEMS'])) { $tmp = array_merge($tmp, toJSON($data[$index]['SUBITEMS'], $level + 1)); } $index++; } return $tmp; }
function toJSON($arr) { $json_str = ""; if (is_array($arr)) { $pure_array = true; $array_length = count($arr); for ($i = 0; $i < $array_length; $i++) { if (!isset($arr[$i])) { $pure_array = false; break; } } if ($pure_array) { $json_str = "["; $temp = array(); for ($i = 0; $i < $array_length; $i++) { $temp[] = sprintf("%s", toJSON($arr[$i])); } $json_str .= implode(",", $temp); $json_str .= "]"; } else { $json_str = "{"; $temp = array(); foreach ($arr as $key => $value) { $temp[] = sprintf("\"%s\":%s", $key, toJSON($value)); } $json_str .= implode(",", $temp); $json_str .= "}"; } } else { if (is_string($arr)) { $json_str = "\"" . json_encode_string($arr) . "\""; } else { if (is_numeric($arr)) { $json_str = $arr; } else { if (is_null($arr)) { $json_str = 'null'; } else { $json_str = "\"" . json_encode_string($arr) . "\""; } } } } return $json_str; }
public function getOut($req) { $mysql = new mysql_class(); $gname = ''; $gtmp = array(); foreach ($this->tables as $gname => $ttable) { $gtmp[$gname]['gname'] = $gname; $gtmp[$gname]['table'] = $ttable; $gtmp[$gname]['contentDiv'] = $this->contentDiv[$gname]; $gtmp[$gname]['canAdd'] = $this->canAdd[$gname]; $gtmp[$gname]['canEdit'] = $this->canEdit[$gname]; $gtmp[$gname]['canDelete'] = $this->canDelete[$gname]; $gtmp[$gname]['targetFile'] = $this->targetFile[$gname]; $gtmp[$gname]['cssClass'] = $this->cssClass[$gname]; $gtmp[$gname]['start'] = $this->start[$gname]; $gtmp[$gname]['addColCount'] = $this->addColCount[$gname]; $gtmp[$gname]['tableProperty'] = $this->tableProperty[$gname]; $gtmp[$gname]['css'] = $this->css[$gname]; $this->pageAllRows[$gname] = $this->getTableRowCount($ttable, $req); $this->pageCount[$gname] = $this->getPageCount($ttable, $this->pageRows[$gname], $req); $gtmp[$gname]['pageCount'] = $this->pageCount[$gname]; $gtmp[$gname]['pageNumber'] = $this->pageNumber[$gname]; $gtmp[$gname]['eRequest'] = $this->eRequest[$gname]; $gtmp[$gname]['alert'] = $this->alert; $gtmp[$gname]['disableRowColor'] = $this->disableRowColor[$gname]; } if (isset($req['command']) && isset($req['table']) && $req['command'] != 'csv') { $gname = trim($req['table']); $table = $this->tables[$gname]; $this->done = TRUE; $fn = ''; if (isset($req['field'])) { $fn = isset($this->column[$gname][$this->fieldToId($gname, $req['field'])]['cfunction'][1]) ? $this->column[$gname][$this->fieldToId($gname, $req['field'])]['cfunction'][1] : ''; } $this->out[$gname] = 'error'; switch ($req['command']) { case 'update': if (isset($req['field']) && isset($req['value']) && isset($req['id'])) { $this->out[$gname] = $this->update($table, $req['id'], $req['field'], $req['value'], $fn, $gname); } else { $this->out[$gname] = 'failed'; } break; case 'delete': if (isset($req['ids']) && $req['ids'] != '') { $this->out[$gname] = $this->delete($table, $req['ids'], $gname); } else { $this->out[$gname] = 'failed'; } break; case 'insert': $this->out[$gname] = $this->insert($gname, $table, $req); break; /* case 'csv': $all = $req['all']=='1'?TRUE:FALSE; if(!$all) { //$csvTmp = fromJSON($req['data']); $csvFileName = '../csv/'.$req['fname']; $csvF = fopen($csvFileName,"w+"); foreach($csvTmp as $line) fputcsv($csvF,$line); fclose($csvF); $this->out[$gname] = '../csv/'.$req['fname']; } else $this->out[$gname] = ''; break; */ } $this->pageCount[$gname] = $this->getPageCount($table, $this->pageRows[$gname], $req); $this->out[$gname] = $this->out[$gname] . ',' . $this->pageCount[$gname] . ',' . $gname; } else { if (isset($req['pageNumber']) && isset($req['table'])) { $gname = trim($req['table']); $isCsv = isset($req['command']) && $req['command'] == 'csv'; $whereClause = $this->whereClause[$gname]; $werc = isset($req['werc']) ? $req['werc'] : ''; $werc = str_replace('|', '%', $werc); $werc = str_replace('where', ' ', $werc); $werc = str_replace("\\'", "'", $werc); if ($werc != '' || $whereClause != '') { $werc = ' where ' . $werc . ' ' . ($werc != '' && $whereClause != '' ? 'and ' . $whereClause : $whereClause); } $ttable = $this->tables[$gname]; $this->pageCount[$gname] = $this->getPageCount($ttable, $this->pageRows[$gname], $req); $this->done = TRUE; $gname = trim($req['table']); $table = $this->tables[$gname]; if (isset($req['pageNumber'])) { $this->pageNumber[$gname] = (int) $req['pageNumber']; } $sort = ''; $sort_array = array(); foreach ($req as $rk => $rv) { $sort_tmp = explode("-", $rk); if (count($sort_tmp) == 2 && $sort_tmp[0] == 'sort') { $sort_array[] = $rv; } } if (count($sort_array) > 0) { $sort = (strpos($werc, 'order') === FALSE ? " order by `" : ',`') . implode('` desc,`', $sort_array) . "` desc"; } if ($this->echoQuery) { echo 'select * from `' . $table . '` ' . $werc . ' ' . $sort . ' limit ' . (int) (($this->pageNumber[$gname] - 1) * $this->pageRows[$gname]) . ',' . (int) $this->pageRows[$gname] . "<br/>\n"; } $mysql->ex_sql('select * from `' . $table . '` ' . $werc . ' ' . $sort . ' limit ' . (int) (($this->pageNumber[$gname] - 1) * $this->pageRows[$gname]) . ',' . (int) $this->pageRows[$gname], $q); $i = 0; $row = array(); $csvHead = ""; $loadHead = TRUE; $csvBigBody = ""; foreach ($q as $rr) { $cell = array(); $csvBody = ''; foreach ($this->column[$gname] as $k => $field) { $fn = isset($field['cfunction'][0]) ? $field['cfunction'][0] : ''; //$tValue = ($fn!='')?$fn(htmlentities($rr[$field['fieldname']])):htmlentities($rr[$field['fieldname']]); $tValue = $fn != '' ? $fn($rr[$field['fieldname']]) : $rr[$field['fieldname']]; if ($loadHead) { $csvHead .= ($csvHead != '' ? "," : '') . $field['fieldname']; } //$tmpVal = str_replace("\n",'',((!isset($this->column[$gname][$k]['clist']))?$tValue:$this->column[$gname][$k]['clist'][$rr[$field['fieldname']]])); //$tmpVal = str_replace(',','',$tmpVal); //$tmpVal = mb_convert_encoding($tmpVal,'UTF-8');//,"Windows-1256"); //$tmpVal = mb_convert_encoding($tmpVal, 'UTF-16LE', 'UTF-8'); //$tmpVal = mb_convert_encoding($tmpVal,"Windows-1252"); //if($k > 0) // $csvBody .= (($csvBody!='')?",":'').strip_tags($tmpVal); $cell[] = array('value' => $tValue, 'css' => $this->loadCellCss($rr['id'], $field['fieldname']), 'typ' => $field['typ']); if (in_array($field['fieldname'], $sort_array)) { $this->column[$gname][$k]['sort'] = 'done'; } } $loadHead = FALSE; $csvBigBody .= "{$csvBody}\n"; $row[] = array('cell' => $cell, 'css' => $this->loadRowCss($rr['id'], $gname)); } $rowCount = xgrid::getTableRowCount($ttable, $req); foreach ($this->column[$gname] as $indx => $column) { if (isset($column['clist'])) { $this->column[$gname][$indx]['clist'] = $this->arrayToObject($column['clist']); } if (isset($column['searchDetails'])) { $this->column[$gname][$indx]['searchDetails'] = $this->arrayToObject($column['searchDetails']); } } $grid = array('column' => $this->column[$gname], 'rows' => $row, 'cssClass' => $this->css[$gname], 'tableProperty' => $this->tableProperty[$gname], 'css' => '', 'buttonTitles' => $this->buttonTitles[$gname], 'eRequest' => $this->eRequest[$gname], 'pageCount' => $this->pageCount[$gname], 'alert' => $this->alert, 'scrollDown' => $this->scrollDown[$gname], 'xls' => $this->xls[$gname], 'pageRows' => $this->pageRows[$gname], 'rowCount' => $rowCount); if (!$isCsv) { $affn = $this->afterCreateFunction[$gname]; if ($affn != '') { $fgrid = $affn($grid); } else { $fgrid = $grid; } $this->out[$gname] = toJSON($fgrid); } else { $csvOut = ""; header('Content-Type: text/csv; charset=utf8'); header('Content-disposition: attachment;filename=' . $req['table'] . '.csv'); header('Content-type: application/x-msdownload'); $this->out[$gname] = $csvBigBody; //.mb_convert_encoding($csvHead."\n".$csvBigBody, 'UTF-16LE', 'UTF-8'); } } } $gtmp[$gname]['pageCount'] = $this->pageCount[$gname]; $this->arg = toJSON($gtmp); return isset($this->out[$gname]) ? $this->out[$gname] : ''; }
function respond($err, $resume = null, $fname = null) { $data = ['error' => $err, 'resume' => $resume, 'fname' => $fname]; echo toJSON($data); }
public function ps_pay($pardakht_id, $amount) { $conf = new conf(); require_once "../class/RSAProcessor.class.php"; include_once "../simplejson.php"; $processor = new RSAProcessor("../class/certificate.xml", RSAKeyType::XMLFile); $pardakht = new pardakht_class((int) $pardakht_id); $merchantCode = $conf->ps_merchantCode; $terminalCode = $conf->ps_terminalCode; $redirectAddress = $conf->ps_redirectAddress; $invoiceNumber = $pardakht_id; $timeStamp = str_replace('-', '/', $pardakht->tarikh); $invoiceDate = str_replace('-', '/', $pardakht->tarikh); $action = "1003"; // 1003 : براي درخواست خريد $data = "#" . $merchantCode . "#" . $terminalCode . "#" . $invoiceNumber . "#" . $invoiceDate . "#" . $amount . "#" . $redirectAddress . "#" . $action . "#" . $timeStamp . "#"; $data = sha1($data, true); $data = $processor->sign($data); // امضاي ديجيتال $result = base64_encode($data); // base64_encode $out['invoiceNumber'] = $invoiceNumber; $out['invoiceDate'] = $invoiceDate; $out['amount'] = $amount; $out['terminalCode'] = $terminalCode; $out['merchantCode'] = $merchantCode; $out['redirectAddress'] = $redirectAddress; $out['timeStamp'] = $timeStamp; $out['action'] = $action; $out['sign'] = $result; $outJson = toJSON($out); return $outJson; }
<?php /** * Provisioner evolution elements * * @category Provisioning * @author S. Hamblett <*****@*****.**> * @copyright 2010 S. Hamblett * @license GPLv3 http://www.gnu.org/licenses/gpl.html * @link none * * @package provisioner */ /* Protection */ if (REVO_GATEWAY_OPEN != "true") { die("Revo Gateway API error - Invalid access"); } $nodes = array(); /* Grab all the root categories */ $db = connectToDb(); $sql = "SELECT * FROM " . $table_prefix . 'categories'; $result = mysql_query($sql, $db); while ($category = mysql_fetch_assoc($result)) { $class = 'icon-category folder'; $nodes[] = array('text' => $category['category'] . ' (' . $category['id'] . ')', 'id' => 'n_category_' . $category['id'], 'pk' => $category['id'], 'data' => $category, 'category' => $category['id'], 'leaf' => true, 'cls' => $class, 'page' => '', 'classKey' => 'modCategory', 'type' => 'category'); } mysql_close($db); echo toJSON($nodes);
function json_encode2($value) { if ($value === null) { return 'null'; } // gettype fails on null? $out = ''; $esc = "\"\\/\n\r\t" . chr(8) . chr(12); // escaped chars $l = '.'; // decimal point switch (gettype($value)) { case 'boolean': $out .= $value ? 'true' : 'false'; break; case 'float': case 'double': // PHP uses the decimal point of the current locale but JSON expects %x2E $l = localeconv(); $l = $l['decimal_point']; // fallthrough... // fallthrough... case 'integer': $out .= str_replace($l, '.', $value); // what, no getlocale? break; case 'array': // if array only has numeric keys, and is sequential... ? for ($i = 0; $i < count($value) && isset($value[$i]); $i++) { } if ($i === count($value)) { // it's a "true" array... or close enough $out .= '[' . implode(',', array_map('toJSON', $value)) . ']'; break; } // fallthrough to object for associative arrays... // fallthrough to object for associative arrays... case 'object': $arr = is_object($value) ? get_object_vars($value) : $value; $b = array(); foreach ($arr as $k => $v) { $b[] = '"' . addcslashes($k, $esc) . '":' . toJSON($v); } $out .= '{' . implode(',', $b) . '}'; break; default: // anything else is treated as a string return '"' . addcslashes($value, $esc) . '"'; break; } return $out; }
<?php include_once "../kernel.php"; $SESSION = new session_class(); register_shutdown_function('session_write_close'); session_start(); if (!isset($_SESSION[$conf->app . '_user_id'])) { die('error'); } $se = security_class::auth((int) $_SESSION[$conf->app . '_user_id']); if (!$se->can_view) { die('error'); } include_once "../simplejson.php"; echo toJSON(session_class::onlineSessions());
<? echo toJSON( $data );
$p_i++; } for ($k = 0; $k < count($tmp_id); $k++) { } if ($kharid_typ == 'naghdi') { $bool = TRUE; $tarikh_now = date("Y-m-d H:i:s"); /* for($k=0;$k<count($tmp_id);$k++) if(!ticket_class::updateTmp($tmp_id[$k],$info_ticket)) $bool = FALSE; * */ if ($bool) { $mysql = new mysql_class(); $pardakht_id = pardakht_class::add(implode(',', $tmp_id), $tarikh_now, $jam_ghimat1, toJSON(array('ticket' => $info_ticket, 'parvaz' => $log_text_info, 'netlog' => $netlog, 'rwaitlog' => $rwaitlog))); $pardakht = new pardakht_class($pardakht_id); $rahgiri = $pardakht->getBarcode(); if ($conf->ps === TRUE) { $pay_code = pay_class::ps_pay($pardakht_id, $jam_ghimat1); } else { if ($conf->payline === TRUE) { $pay_code = pay_class::pl_pay($pardakht_id, $jam_ghimat1); $mysql->ex_sqlx("update `pardakht` set `bank_out` = '{$pay_code}' where `id` = {$pardakht_id}"); } else { $pay_code = pay_class::pay($pardakht_id, $jam_ghimat1); } } //var_dump($pay_code); $tmpo = explode(',', $pay_code); if (count($tmpo) == 2 && $tmpo[0] == 0 && $conf->ps !== 'TRUE') {
function toJSON($data) { require_once 'include/utils.php'; $json = getJSONobj(); return $json->encode($data); } function findEntity() { $document = new Document(); // Dokument wiederfinden -> Todo: anhand der field_defs generisch suchen $result = $document->get_list('', 'document_name = "' . $_REQUEST['document_name'] . '"'); return $result['list'][0]; } function getRevisionBean() { $document = new Document(); // Dokument wiederfinden -> Todo: anhand der field_defs generisch suchen if ($_REQUEST['return_id'] != "" && $_REQUEST['return_id'] != "undefined") { $document_id = $_REQUEST['return_id']; if ($document->retrieve($document_id)) { return $document; } } else { die('Could not get document id!'); } } header("Content-type: application/json"); echo toJSON(create_array(getRevisionBean())); session_write_close(); ?>
$sql = "SELECT fullname, email, blocked FROM " . $table_prefix . "user_attributes" . " WHERE `internalKey` = " . $manager_user['id']; $result = mysql_query($sql, $db); while ($manageruser = mysql_fetch_assoc($result)) { $manageruser['username'] = $manager_user['username']; $manageruser['id'] = $manager_user['id']; if ($manageruser['blocked'] == 1) { $manageruser['true']; } else { $manageruser['blocked'] = false; } $users[] = $manageruser; } } foreach ($web_users as $web_user) { $sql = "SELECT fullname, email, blocked FROM " . $table_prefix . "web_user_attributes" . " WHERE `internalKey` = " . $web_user['id']; $result = mysql_query($sql, $db); while ($webuser = mysql_fetch_assoc($result)) { $webuser['username'] = $web_user['username']; $webuser['id'] = $web_user['id'] . '_w'; if ($webuser['blocked'] == 1) { $webuser['true']; } else { $webuser['blocked'] = false; } $users[] = $webuser; } } mysql_close($db); $count = count($users); $response = '({"total":"' . $count . '","results":' . toJSON($users) . '})'; echo $response;
$class .= ' unpublished'; } if ($item['deleted'] == 1) { $class .= ' deleted'; } else { $class .= ' '; } if ($item['hidemenu'] == 1) { $class .= ' hidemenu'; } else { $class .= ' '; } $qtip = ''; if ($item['longtitle'] != '') { $qtip = '<b>' . $item['longtitle'] . '</b><br />'; } if ($item['description'] != '') { $qtip = '<i>' . $item['description'] . '</i>'; } $itemArray = array('text' => $item['pagetitle'] . ' (' . $item['id'] . ')', 'id' => 'evolution' . '_' . $item['id'], 'pk' => $item['id'], 'cls' => $class, 'type' => 'modResource', 'classKey' => 'modDocument', 'key' => $item['id'], 'ctx' => 'evolution', 'qtip' => $qtip, 'preview_url' => '', 'page' => '', 'allowDrop' => true); if ($hasChildren) { $itemArray['hasChildren'] = true; $itemArray['children'] = array(); $itemArray['expanded'] = true; } $items[] = $itemArray; unset($qtip, $class, $itemArray, $hasChildren); } mysql_close($db); echo toJSON($items);
<question qid="{_id}" class="vanilla" vanilla="{vanilla}" style="{style}"> <op class="{optype}"></op> <text>{text}</text> </question> </questiontemplate> <vanillaquestionsdata class="hide"> <?php $vanillaQuestions = View::get('vanillaQuestions'); echo toJSON($vanillaQuestions); ?> </vanillaquestionsdata> <chosenquestionsdata class="hide"> <?php $chosen = View::get('chosen'); echo toJSON($chosen); ?> </chosenquestionsdata> <script> function getQuestionFromTemplate(_id, text, elemClass, hide) { var style = ''; if (hide) { style = 'display: none;'; } var html = useTemplate('questiontemplate', { text: text, _id: _id, class: elemClass, style: style, optype: 'plus',
function json_encode($value) { return toJSON($value); }
); </script> </div> <div id="showHideDiv4"> <canvas id="180days" width="900" height="400"></canvas> <script> drawBarGraph("180days", <?php echo toJSON($schoolCount[180]); ?> ); </script> </div> <div id="showHideDiv5"> <canvas id="foreverdays" width="900" height="400"></canvas> <script> drawBarGraph("foreverdays", <?php echo toJSON($schoolCount[FOREVER]); ?> ); </script> </div> <script> updateDiv(5, 5, "Forever"); </script> </left> </div> </panel>
protected static function ajaxSuccess() { echo toJSON(['error' => null]); return true; }
// chdir('..'); require_once 'include/entryPoint.php'; require_once 'data/SugarBean.php'; require_once 'modules/Documents/Document.php'; function create_array($bean) { $data = array(); foreach ($bean->field_defs as $field_def) { $fieldname = $field_def['name']; $data[] = array($fieldname => $bean->{$fieldname}); } return $data; } function toJSON($data) { require_once 'include/utils.php'; $json = getJSONobj(); return $json->encode($data); } function findEntity() { $document = new Document(); // Dokument wiederfinden -> Todo: anhand der field_defs generisch suchen $result = $document->get_list('', 'document_name = "' . $_REQUEST['document_name'] . '"'); return $result['list'][0]; } header("Content-type: application/json"); echo toJSON(create_array(findEntity())); session_write_close(); ?>
function outputArray($output) { $count = count($output); $response = '({"total":"' . $count . '","results":' . toJSON($output) . '})'; return $response; }
} $fullname = $fullpath . '/' . $name; if (!is_readable($fullname)) { continue; } $fileName = $name; $filePathName = $fullpath; /* handle dirs */ if (is_dir($fullname)) { $cls = 'folder'; $directories[$fileName] = array('id' => utf8_encode($dir . $fileName), 'text' => utf8_encode($fileName), 'cls' => $cls, 'type' => 'dir', 'leaf' => false, 'perms' => ''); } /* get files in current dir */ if (is_file($fullname)) { $ext = pathinfo($filePathName, PATHINFO_EXTENSION); $cls = 'icon-file icon-' . $ext; $files[$fileName] = array('id' => utf8_encode($dir . $fileName), 'text' => utf8_encode($fileName), 'cls' => $cls, 'type' => 'file', 'leaf' => true, 'perms' => '', 'path' => $relativeRootPath . $fileName, 'file' => rawurlencode($filePathName)); } } /* now sort files/directories */ ksort($directories); foreach ($directories as $dir) { $ls[] = $dir; } ksort($files); foreach ($files as $file) { $ls[] = $file; } mysql_close($db); echo toJSON($ls);
} // RDF to JSON: $postdata = file_get_contents("php://input"); if (empty($postdata)) { echo '{ "status": "failed", "error": "no input" }'; return; } $store = new LibRDF_Storage(); $model = new LibRDF_Model($store); try { $model->loadStatementsFromString(new LibRDF_Parser('rdfxml'), $postdata); } catch (LibRDF_Error $e) { echo '{ "status": "failed", "error": "parser error" }'; return; } toJSON($model); function toJSON($model) { $data = array('data' => array()); $predicate = new LibRDF_URINode(RDF_BASE_URI . "type"); $object = new LibRDF_URINode(ROAP . "Document"); $results = $model->findStatements(null, $predicate, $object); if ($results->valid()) { $document = $results->current()->getSubject(); $predicate = new LibRDF_URINode(ROAP . "lines"); $results = $model->findStatements($document, $predicate, null); if ($results->valid()) { $lines = $results->current()->getObject(); $predicate = new LibRDF_URINode(RDF_BASE_URI . "type"); $object = new LibRDF_URINode(RDF_BASE_URI . "Seq"); $results = $model->findStatements($lines, $predicate, $object);
</div> </jobtemplate> <nojobstemplate> <b style="font-size: 1.5em;"> Congratulations! You have completed your company profile and are on your way to recruiting the most talented students. Just take a moment to complete your job listing(s) by clicking the button below and you'll be all set! </b> </nojobstemplate> </templates> <jobData class="hide"> <?php $jobs = View::get('jobs'); echo toJSON($jobs); ?> </jobData> <script> function setupJobHover() { $('.jobblock').hover(function () { $(this).children('.buttons').finish().slideDown(200, 'easeInOutCubic'); }, function () { $(this).children('.buttons').finish().slideUp(200, 'easeInOutCubic'); }) } $(function () { (function setupJobs() { var jobData = JSON.parse($('jobData').html());
$ou['tarikh1'] = jdate("Y/m/d", strtotime($q[0]['tarikh'])); } } else { $q = null; $my->ex_sql("select count(id) cid from parvaz_det where en=1 and strsource='" . $req[2]['value'] . "' and strdest='" . $req[1]['value'] . "' and tarikh='" . $req[4]['value'] . "'", $q); if ((int) $q[0]['cid'] == 0) { $q = null; $my->ex_sql("select tarikh from parvaz_det where en=1 and strsource='" . $req[2]['value'] . "' and strdest='" . $req[1]['value'] . "' order by tarikh,saat limit 1", $q); if (count($q) > 0) { $ou['stat'] = 'err2'; $ou['tarikh2'] = jdate("Y/m/d", strtotime($q[0]['tarikh'])); } } } } die(toJSON($ou)); } if (isset($_REQUEST['s_mabda'])) { $out = '<select id="smaghsad" name="smaghsad" class="ser" style="width:100%" >'; $strsource = trim($_REQUEST['s_mabda']); $my = new mysql_class(); $my->ex_sql("select strdest from parvaz_det where strsource='{$strsource}' group by strdest order by strdest", $q); foreach ($q as $r) { $out .= '<option value="' . $r['strdest'] . '" >' . $r['strdest'] . '</option>'; } $out .= '</select>'; die($out); } if (isset($_POST['change_parvaz'])) { $parvaz_ids = ''; $mod = trim($_POST['mod']);
public static function view(array $restOfRoute) { JobController::requireLogin(); $applicationId = self::getIdFromRoute($restOfRoute); if (is_null($applicationId)) { return; } $application = ApplicationStudent::getById($applicationId); if (is_null($application)) { self::error("nonexistent application"); self::render('notice'); return; } // Only the student who submitted the application and the recruiter // associated with the job can view the application. $myId = $_SESSION['_id']; $jobId = $application->getJobId(); $studentId = $application->getStudentId(); $recruiterId = JobModel::getRecruiterId($jobId); $isRecruiter = $recruiterId == $myId; $isStudent = $studentId == $myId; if (!$isStudent && !$isRecruiter) { self::error("permission denied"); self::render('notice'); return; } // Retrieve data for student. $student = StudentModel::getById($studentId, ['name' => 1]); $studentName = $student['name']; // Retrieve data on the job. $job = JobModel::getById($jobId); $title = $job['title']; $companyId = $job['company']; $company = CompanyModel::getById($companyId); // Set data from application. $profile = $application->getProfile(); $questions = $application->getQuestions(); // Add 'text' to questions to show. $responses = []; foreach ($questions as $question) { $_id = $question['_id']; $responses[] = ['_id' => $_id, 'text' => Question::getTextById($_id), 'answer' => $question['answer']]; } self::render('jobs/applications/view', ['responses' => toJSON($responses), 'studentname' => $studentName, 'jobtitle' => $title, 'companytitle' => $company['name'], 'isStudent' => $isStudent, 'isRecruiter' => $isRecruiter, 'studentId' => $studentId, 'recruiterId' => $recruiterId]); self::render('jobs/student/studentprofile', ['profile' => toJSON($profile)]); self::render('jobs/applications/report', ['applicationId' => $applicationId, 'isStudent' => $isStudent, 'isRecruiter' => $isRecruiter]); }
public static function moveApplications() { RecruiterController::requireLogin(); global $params; $selected = MongoIdArray($params['selected']); $to = $params['to']; $recruiterId = $_SESSION['_id']; // Make sure all selected are owned. foreach ($selected as $applicationId) { if (!ApplicationModel::isOwned($recruiterId, $applicationId)) { echo toJSON(['error' => 'permission denied']); return; } } // Mark new status. foreach ($selected as $applicationId) { ApplicationStudent::changeStatus($applicationId, $to); } return self::ajaxSuccess(); }
* Provisoner files evolution component * * @category Provisioning * @author S. Hamblett <*****@*****.**> * @copyright 2010 S. Hamblett * @license GPLv3 http://www.gnu.org/licenses/gpl.html * @link none * * @package provisioner * */ /* Protection */ if (REVO_GATEWAY_OPEN != "true") { die("Revo Gateway API error - Invalid access"); } /* format filename */ $file = rawurldecode($scriptProperties['file']); if (!file_exists($file)) { $response = errorFailure(" : No file found : ", array('name' => $file)); echo json_encode($response); return; } $filename = ltrim(strrchr($file, '/'), '/'); /* Encode into base64 for transmission */ $fbuffer = @file_get_contents($file); $fbuffer = base64_encode($fbuffer); $time_format = '%b %d, %Y %H:%I:%S %p'; $fa = array('name' => utf8_encode($filename), 'size' => filesize($file), 'last_accessed' => strftime($time_format, fileatime($file)), 'last_modified' => strftime($time_format, filemtime($file)), 'content' => $fbuffer); $response = errorSuccess('', $fa); echo toJSON($response);
public static function getCards() { RecruiterController::requireLogin(); $recruiterId = $_SESSION['_id']; $cards = StripeBilling::getCardsByRecruiter($recruiterId); echo toJSON($cards); }
function toDDJSON() { $arrReturn = array(); if (!$this->getArray()) { return toJSON($arrReturn); } foreach ($this->getArray() as $objObject) { $arrReturn[$objObject->getID()] = $objObject->getName(); } return toJSON($arrReturn); }
public function getOut($req) { $mysql = new mysql_class(); $gname = ''; $gtmp = array(); foreach ($this->tables as $gname => $ttable) { $gtmp[$gname]['gname'] = $gname; $gtmp[$gname]['table'] = $ttable; $gtmp[$gname]['contentDiv'] = $this->contentDiv[$gname]; $gtmp[$gname]['canAdd'] = $this->canAdd[$gname]; $gtmp[$gname]['canEdit'] = $this->canEdit[$gname]; $gtmp[$gname]['canDelete'] = $this->canDelete[$gname]; $gtmp[$gname]['targetFile'] = $this->targetFile[$gname]; $gtmp[$gname]['cssClass'] = $this->cssClass[$gname]; $gtmp[$gname]['start'] = $this->start[$gname]; $gtmp[$gname]['addColCount'] = $this->addColCount[$gname]; $gtmp[$gname]['tableProperty'] = $this->tableProperty[$gname]; $gtmp[$gname]['css'] = $this->css[$gname]; $this->pageAllRows[$gname] = $this->getTableRowCount($ttable, $req); $this->pageCount[$gname] = $this->getPageCount($ttable, $this->pageRows[$gname], $req); $gtmp[$gname]['pageCount'] = $this->pageCount[$gname]; $gtmp[$gname]['pageNumber'] = $this->pageNumber[$gname]; $gtmp[$gname]['eRequest'] = $this->eRequest[$gname]; $gtmp[$gname]['alert'] = $this->alert; $gtmp[$gname]['disableRowColor'] = $this->disableRowColor[$gname]; } if (isset($req['command']) && isset($req['table'])) { $gname = trim($req['table']); $table = $this->tables[$gname]; $this->done = TRUE; $fn = ''; if (isset($req['field'])) { $fn = isset($this->column[$gname][$this->fieldToId($gname, $req['field'])]['cfunction'][1]) ? $this->column[$gname][$this->fieldToId($gname, $req['field'])]['cfunction'][1] : ''; } $this->out[$gname] = 'error'; switch ($req['command']) { case 'update': if (isset($req['field']) && isset($req['value']) && isset($req['id'])) { $this->out[$gname] = $this->update($table, $req['id'], $req['field'], $req['value'], $fn, $gname); } else { $this->out[$gname] = 'failed'; } break; case 'delete': if (isset($req['ids']) && $req['ids'] != '') { $this->out[$gname] = $this->delete($table, $req['ids'], $gname); } else { $this->out[$gname] = 'failed'; } break; case 'insert': $this->out[$gname] = $this->insert($gname, $table, $req); break; } $this->pageCount[$gname] = $this->getPageCount($table, $this->pageRows[$gname], $req); $this->out[$gname] = $this->out[$gname] . ',' . $this->pageCount[$gname] . ',' . $gname; } else { if (isset($req['pageNumber']) && isset($req['table'])) { $gname = trim($req['table']); $whereClause = $this->whereClause[$gname]; $werc = isset($req['werc']) ? $req['werc'] : ''; $werc = str_replace('|', '%', $werc); $werc = str_replace('where', ' ', $werc); $werc = str_replace("\\'", "'", $werc); if ($werc != '' || $whereClause != '') { $werc = ' where ' . $werc . ' ' . ($werc != '' && $whereClause != '' ? 'and ' . $whereClause : $whereClause); } $ttable = $this->tables[$gname]; $this->pageCount[$gname] = $this->getPageCount($ttable, $this->pageRows[$gname], $req); $this->done = TRUE; $gname = trim($req['table']); $table = $this->tables[$gname]; if (isset($req['pageNumber'])) { $this->pageNumber[$gname] = (int) $req['pageNumber']; } $sort = ''; $sort_array = array(); foreach ($req as $rk => $rv) { $sort_tmp = explode("-", $rk); if (count($sort_tmp) == 2 && $sort_tmp[0] == 'sort') { $sort_array[] = $rv; } } if (count($sort_array) > 0) { $sort = (strpos($werc, 'order') === FALSE ? " order by `" : ',`') . implode('`,`', $sort_array) . "`"; } if ($this->echoQuery) { echo 'select * from `' . $table . '` ' . $werc . ' ' . $sort . ' limit ' . (int) (($this->pageNumber[$gname] - 1) * $this->pageRows[$gname]) . ',' . (int) $this->pageRows[$gname] . "<br/>\n"; } $mysql->ex_sql('select * from `' . $table . '` ' . $werc . ' ' . $sort . ' limit ' . (int) (($this->pageNumber[$gname] - 1) * $this->pageRows[$gname]) . ',' . (int) $this->pageRows[$gname], $q); $i = 0; $row = array(); foreach ($q as $rr) { $cell = array(); foreach ($this->column[$gname] as $k => $field) { $fn = isset($field['cfunction'][0]) ? $field['cfunction'][0] : ''; //$tValue = ($fn!='')?$fn(htmlentities($rr[$field['fieldname']])):htmlentities($rr[$field['fieldname']]); $tValue = $fn != '' ? $fn($rr[$field['fieldname']]) : $rr[$field['fieldname']]; $cell[] = array('value' => $tValue, 'css' => $this->loadCellCss($rr['id'], $field['fieldname']), 'typ' => $field['typ']); if (in_array($field['fieldname'], $sort_array)) { $this->column[$gname][$k]['sort'] = 'done'; } } $row[] = array('cell' => $cell, 'css' => $this->loadRowCss($rr['id'])); } $grid = array('column' => $this->column[$gname], 'rows' => $row, 'cssClass' => $this->css[$gname], 'tableProperty' => $this->tableProperty[$gname], 'css' => '', 'buttonTitles' => $this->buttonTitles[$gname], 'eRequest' => $this->eRequest[$gname], 'pageCount' => $this->pageCount[$gname], 'alert' => $this->alert); $affn = $this->afterCreateFunction[$gname]; if ($affn != '') { $fgrid = $affn($grid); } else { $fgrid = $grid; } $this->out[$gname] = toJSON($fgrid); } } $gtmp[$gname]['pageCount'] = $this->pageCount[$gname]; $this->arg = toJSON($gtmp); return isset($this->out[$gname]) ? $this->out[$gname] : ''; }