/** * @return string the actual template name */ function getTemplate() { // If saved in session use this one if (isset($_SESSION['template']) && $_SESSION['template'] != false) { return $_SESSION['template']; } //search for a template associated to the current host $plat_templ = parseTemplateDomain($_SERVER['HTTP_HOST']); if ($plat_templ != false) { $_SESSION['template'] = $plat_templ; return $plat_templ; } // search template according to the org_chart_tree option if (!Docebo::user()->isAnonymous()) { $qtxt = "SELECT associated_template FROM\r\n\t\t\t%adm_org_chart_tree\r\n\t\t\tWHERE associated_template IS NOT NULL AND\r\n\t\t\tidst_oc IN (" . implode(',', Docebo::user()->getArrSt()) . ")\r\n\t\t\tORDER BY iLeft DESC\r\n\t\t\tLIMIT 0,1"; $re = sql_query($qtxt); if (mysql_num_rows($re) > 0) { list($template_code) = sql_fetch_row($re); setTemplate($template_code); return $_SESSION['template']; } } // search for the default template $_SESSION['template'] = getDefaultTemplate(); return $_SESSION['template']; }
function edithtml() { checkPerm('mod'); require_once _base_ . '/lib/lib.form.php'; $query = "\r\n\tSELECT textof\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'"; $re_htmlfront = sql_query($query); $error = false; if (isset($_POST['save'])) { if (mysql_num_rows($re_htmlfront) > 0) { $upd_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\tSET textof = '" . $_POST['description'] . "'\r\n\t\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "'"; $re = sql_query($upd_query); } else { $ins_query = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\t( id_course, textof) VALUES \r\n\t\t\t( \t'" . $_SESSION['idCourse'] . "',\r\n\t\t\t\t'" . $_POST['description'] . "' )"; $re = sql_query($ins_query); } if ($re) { Util::jump_to('index.php?modname=htmlfront&op=showhtml&saveok=1'); } else { $error = true; } } $lang =& DoceboLanguage::createInstance('htmlfront', 'lms'); list($textof) = sql_fetch_row($re_htmlfront); $title_page = array('index.php?modname=htmlfront&op=showhtml' => $lang->def('_HTMLFRONT'), $lang->def('_MOD')); $GLOBALS['page']->add(getTitleArea($title_page, 'htmlfront') . '<div class="std_block">' . getBackUi('index.php?modname=htmlfront&op=showhtml', $lang->def('_BACK')) . ($error ? getErrorUi($lang->def('_ERROR_IN_SAVE')) : '') . Form::openForm('formnotes', 'index.php?modname=htmlfront&op=edithtml') . Form::openElementSpace() . Form::getTextarea($lang->def('_TEXTOF'), 'description', 'description', importVar('description', false, $textof)) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function getCountUnreaded($id_user, $courses, &$last_access) { if (empty($courses)) { return array(); } $unreaded = array(); $query_unreaded = "\r\n\t\tSELECT idCourse, UNIX_TIMESTAMP(posted) \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice \r\n\t\tWHERE author <> '" . $id_user . "' AND idCourse IN ( " . implode(',', $courses) . " ) "; $re_advice = sql_query($query_unreaded); if (!mysql_num_rows($re_advice)) { return array(); } while (list($id_c, $posted) = sql_fetch_row($re_advice)) { if (!isset($last_access[$id_c])) { if (isset($unreaded[$id_c])) { $unreaded[$id_c]++; } else { $unreaded[$id_c] = 1; } } elseif ($posted > $last_access[$id_c]) { if (isset($unreaded[$id_c])) { $unreaded[$id_c]++; } else { $unreaded[$id_c] = 1; } } } return $unreaded; }
protected function getDateClassrooms($id_date) { $query = "SELECT DISTINCT classroom" . " FROM %lms_course_date_day" . " WHERE id_date = " . $id_date; $result = sql_query($query); $array_classroom = array(); while (list($id_classroom) = sql_fetch_row($result)) { $array_classroom[$id_classroom] = $id_classroom; } $res = ''; $first = true; if (isset($array_classroom[0])) { $first = false; $res .= Lang::t('_NOT_ASSIGNED', 'admin_date'); } $query = "SELECT name" . " FROM %lms_classroom" . " WHERE idClassroom IN (" . implode(',', $array_classroom) . ")" . " ORDER BY name"; $result = sql_query($query); while (list($name) = sql_fetch_row($result)) { if ($first) { $first = false; $res .= $name; } else { $res .= ', ' . $name; } } return $res; }
function getMatches($col, $name) { global $casen, $table; if ($casen) { return "'{$name}'"; } $name = urlencode($name); $name = str_replace("%C2", "", $name); $name = str_replace("%E2%84", "", $name); foreach (array("[", "]", "{", "}", "(", ")", "<", ">", "\\", "/", ".", ",", "?", "!", "\$", "^", "&", "*", "-", "_", "+", "=", ":", ";", "@", "~", "#", "%", " ") as $ok) { $name = str_replace(urlencode($ok), $ok, $name); } $name = preg_replace("/%[0-9A-F][0-9A-F]/", "_", $name); /* no matching characters = no point matching */ /* if(strpos($name, "%") === false && strpos($name, "_") === false) return "'$name'"; */ $result = sql_query("SELECT {$col} FROM {$table} WHERE {$col} LIKE '{$name}' GROUP BY {$col}"); $ret = ""; $n = 0; while ($row = sql_fetch_row($result)) { if ($n++) { $ret .= ", "; } $ret .= "'{$row[$col]}'"; } return $ret; }
function _LS_LocationPage() { global $dbi, $event, $tdbg; echo setPageTitle('Manage Locations'); echo '<p>Hier werden die Spielstätten bzw. Locations im gesamten Bundesgebiet angezeigt. Ein Klick auf einen Eintrag ladet diesen zum Bearbeiten.<br><b>Unterhalb</b> der Datenmaske werden zugleich alle eingetragenen Heimmannschaften aus dem LigaSystem angezeigt.</p>'; # SECTION 0 Navigation echo '<table bgcolor="' . $tdbg . '" cellpadding="2" cellspacing="1"><tr><td id="btnrefresh" bgcolor="white" onclick="initlocationpage()" onMouseOver="mover(this)" onMouseOut="mout(this)">Tabelle neu laden</td>' . '<td></td><td bgcolor="white" id="locbrowseActivity"><i>Ready</i></td>' . '<td></td><td bgcolor="white" id="locsaveActivity"><i>Ready</i></td>' . '</tr></table><br>'; $location_count_result = sql_query('SELECT COUNT(*) FROM tbllocation l, tverband v WHERE l.lrealm_id = v.id', $dbi); $location_count = 0; while (list($count) = sql_fetch_row($location_count_result, $dbi)) { $location_count = $count; } $response->page = 1; $response->total = 1; $response->records = $location_count; $i = 0; $location_result = sql_query('SELECT * FROM tbllocation l, tverband v WHERE l.lrealm_id = v.id', $dbi); while (list($locid, $lname, $lcity, $lplz, $laddress, $lphone, $lactive, $lrealm_id, $lemail, $lcoordinates, $version, $lkey, $vereinid, $vcode, $vname, $vlogic, $version, $vactive) = sql_fetch_row($location_result, $dbi)) { $response->rows[$i]['id'] = $locid; $response->rows[$i]['cell'] = array($locid, $lname, $lcity, $lplz, $laddress, $lphone, $lactive, $lemail, $vname, $lcoordinates, $lrealm_id); $i++; } echo '<div id="locationData" style="display: none;">' . json_encode($response) . '</div>'; echo '<table id="locationTable"></table><div id="locationPager"></div><script> createLocationTable(); </script>'; # SECTION 2 DETAIL VIEW echo '<div id="frmLocation"><form name="locentry" action="fsaveLocation.php?opcode=save" method="post" target="_blank" onSubmit="submitForm(this);return false;"><fieldset><legend>Location Bearbeiten</legend>'; echo include 'forms/location.php'; echo '</form></div>'; # section 4 BrowseOnSelectedDetail echo '<h3>Aktuelle Heimmannschaften dieser Spielstätte</h3><div id="axteamtable"></div>'; }
public function show() { require_once _base_ . '/lib/lib.navbar.php'; require_once _lms_ . '/lib/lib.middlearea.php'; $ma = new Man_MiddleArea(); $block_list = array(); //if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true; if ($ma->currentCanAccessObj('user_details_full')) { $block_list['user_details_full'] = true; } if ($ma->currentCanAccessObj('credits')) { $block_list['credits'] = true; } if ($ma->currentCanAccessObj('news')) { $block_list['news'] = true; } $query_home = "SELECT title, description FROM learning_webpages where publish=1 and in_home = 1 AND language = '" . getLanguage() . "' LIMIT 1"; $re_home = sql_query($query_home); list($titolo, $descrizione) = sql_fetch_row($re_home); if (!empty($block_list)) { $this->render('_tabs_block', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>", 'block_list' => $block_list)); } else { $this->render('_tabs', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>")); } }
function getLevelOneIntest($idMenu) { $lang =& DoceboLanguage::createInstance('menu', $this->platform); $query_menu = "\r\n\t\tSELECT name, image\r\n\t\tFROM " . $this->table_level_one . "\r\n\t\tWHERE idMenu = '" . (int) $idMenu . "'"; $re_menu = sql_query($query_menu); list($name, $image) = sql_fetch_row($re_menu); return array('name' => $name != '' ? $lang->def($name) : '', 'image' => getPathImage('framework') . 'area_title/' . $image); }
function marquetapage() { global $cookie; if ($cookie[0] != '') { global $REQUEST_URI, $title, $post, $NPDS_Prefix; if ($ibid = theme_image("modules/add.gif")) { $add = $ibid; } else { $add = "modules/marquetapage/add.gif"; } if ($ibid = theme_image("modules/addj.gif")) { $addj = $ibid; } else { $addj = "modules/marquetapage/addj.gif"; } $result = sql_query("SELECT uri, topic FROM " . $NPDS_Prefix . "marquetapage WHERE uid='{$cookie['0']}' ORDER BY topic ASC"); if (sql_num_rows($result)) { $tmp_toggle = '<a class="tog" id="show_fav" title="' . translate("Show list") . '"><i id="i_lst_fav" class="fa fa-caret-right fa-2x" ></i></a>'; $content = "\n <script type=\"text/javascript\">\n //<![CDATA[\n tog = function(lst,sho,hid){\n \$(document).on('click', 'a.tog', function() {\n var buttonID = \$(this).attr('id');\n lst_id = \$('#'+lst);\n i_id=\$('#i_'+lst);\n btn_show=\$('#'+sho);\n btn_hide=\$('#'+hid);\n if (buttonID == sho) {\n lst_id.fadeIn(1000);//show();\n btn_show.attr('id',hid)\n btn_show.attr('title','" . translate("Hide list") . "');\n i_id.attr('class','fa fa-caret-up fa-2x');\n } else if (buttonID == hid) {\n lst_id.fadeOut(1000);//hide();\n btn_hide=\$('#'+hid);\n btn_hide.attr('id',sho);\n btn_hide.attr('title','" . translate("Show list") . "');\n i_id.attr('class','fa fa-caret-down fa-2x');\n }\n });\n };\n //]]>\n </script>"; $content .= ' <h6> <a class="tog" id="show_fav" title="' . translate("Show list") . '"><i id="i_lst_fav" class="fa fa-caret-right fa-2x" ></i> Bookmarks </a><span class="tag tag-pill tag-default pull-right">' . sql_num_rows($result) . '</span> </h6> <ul id="lst_fav" style="display:none;" > <a href="modules.php?ModPath=marquetapage&ModStart=marquetapage&op=supp_all&uri=' . $_SERVER['PHP_SELF'] . '"><i class="fa fa-trash-o text-danger" title="' . translate("Delete") . '" data-toggle="tooltip"></i></a>'; while (list($uri, $topic) = sql_fetch_row($result)) { $content .= ' <li><a href="' . $uri . '" style="font-size:.7rem;">' . $topic . '</a> <span class="float-xs-right"><a href="modules.php?ModPath=marquetapage&ModStart=marquetapage&op=supp&uri=' . urlencode($uri) . '"><i class="fa fa-trash-o text-danger" title="' . translate("Delete") . '" data-toggle="tooltip"></i></a></span></li>'; } $content .= ' </ul> <script type="text/javascript"> //<![CDATA[ tog("lst_fav","show_fav","hide_fav"); //]]> </script>'; } global $block_title; $uri = urlencode($REQUEST_URI); if ($post) { $title .= "/" . $post; } if ($title == '') { $title_MTP = basename(urldecode($uri)); } else { $title_MTP = $title; } $boxTitle = '<span><a href="modules.php?ModPath=marquetapage&ModStart=marquetapage&op=add&uri=' . $uri . '&topic=' . urlencode($title_MTP) . '"><i class="fa fa-bookmark-o " title="' . translate("Add") . ' ' . translate("favourite") . '" data-toggle="tooltip"></i></a></span>'; if ($block_title == '') { $boxTitle .= ' MarqueTaPage'; } else { $boxTitle .= ' ' . $block_title; } themesidebox($boxTitle, $content); } }
function getMasInformacion($id, &$nombre, &$nickfacebook, &$imagen, &$categoria, &$direccion, &$telefono, &$paginaweb) { global $dbi; if (!$id) { return 0; } $result = sql_query("SELECT `nombre`, `nickfacebook`, `imagen`, `categoria`, `direccion`, `telefono`, `paginaweb` FROM `sitios` WHERE " . "`id`='" . $id . "'", $dbi) or die(mysql_error(0)); list($nombre, $nickfacebook, $imagen, $categoria, $direccion, $telefono, $paginaweb) = sql_fetch_row($result); }
function query_to_hash($query) { $ret = array(); $result = sql_query_dbg($query); while ($row = sql_fetch_row($result)) { $ret[$row[0]] = $row[1]; } return $ret; }
/** * @return array of param **/ function getLOParamArray($idParam) { $query = "SELECT param_name, param_value FROM " . $GLOBALS['prefix_lms'] . "_lo_param " . "WHERE idParam = '" . (int) $idParam . "'"; $rs = sql_query($query) or errorCommunication('getLOParam'); $result = array(); while (list($param_name, $param_value) = sql_fetch_row($rs)) { $result[$param_name] = $param_value; } return $result; }
function sql_query($ticket_id) { global $tts, $user, $name, $prefix, $hlpdsk_prefix; //load values from db $query = "select `ticket_number`, \n\t\t`t_assigned`,\n `t_from`,\n `t_stage`,\n `t_category`,\n `t_priority`,\n `t_subject`,\n `t_description`,\n `t_comments`,\n `post_date`,\n `complete`,\n `due_date`,\n `end_date`,\n `change_date`,\n `t_status`,\n `t_sms`,\n `t_email`\n\n\t\twhere \n Ticket_Number='{$this->ticket_nr}'"; if ($result = sql_query($query)) { list($this->ticket_nr, $this->assigned_id, $this->issuer, $this->stage_id, $this->category_id, $this->priority_id, $this->subject, $this->description, $this->comments, $this->post_date, $this->complete, $this->due_date, $this->end_date, $this->change_date, $this->status_id, $this->notify_priv_msg, $this->notify_email) = sql_fetch_row($result); } return $result; }
public function getEditionIdFromCourse($id_course) { $query = "SELECT id_edition" . " FROM %lms_course_editions" . " WHERE id_course = " . (int) $id_course; $result = sql_query($query); $res = array(); while (list($id_edition) = sql_fetch_row($result)) { $res[$id_edition] = $id_edition; } return $res; }
/** * @param int $idMain if passed return the first voice of the relative menu * * @return array with three element modulename and op that contains the first accessible menu element * indicate in idMain array( [idMain], [modulename], [op] ) **/ function firstPage($idMain = false) { $query_main = "\r\n\tSELECT module.idModule, main.idMain, module.module_name, module.default_op, module.token_associated \r\n\tFROM ( " . $GLOBALS['prefix_lms'] . "_menucourse_main AS main JOIN\r\n\t\t" . $GLOBALS['prefix_lms'] . "_menucourse_under AS un ) JOIN\r\n\t\t" . $GLOBALS['prefix_lms'] . "_module AS module\r\n\tWHERE main.idMain = un.idMain AND un.idModule = module.idModule \r\n\t\tAND main.idCourse = '" . (int) $_SESSION['idCourse'] . "'\r\n\t\tAND un.idCourse = '" . (int) $_SESSION['idCourse'] . "'\r\n\t\t" . ($idMain !== false ? " AND main.idMain='" . $idMain . "' " : '') . "\r\n\tORDER BY main.sequence, un.sequence"; $re_main = sql_query($query_main); while (list($id_module, $main, $module_name, $default_op, $token) = sql_fetch_row($re_main)) { if (checkPerm($token, true, $module_name)) { return array('idModule' => $id_module, 'idMain' => $main, 'modulename' => $module_name, 'op' => $default_op); } } }
public function getCourseName() { $query = "SELECT idCourse, name" . " FROM %lms_course"; $result = sql_query($query); $res = array(); while (list($id_course, $name) = sql_fetch_row($result)) { $res[$id_course] = $name; } return $res; }
function _listverein($findstr = '') { /* * List is a Meldewesen Public function, no restrictions here ... * all Meldewesen accounts can see this List here ... + Vereinsaccount his own Verein * TODO generate snippet listing ... */ global $dbi, $vereinsdb, $sctdcolor, $dartred, $dartgreen, $imgdetail, $imgedit, $usertoken; if (sizeof($usertoken['registermap']) < 1) { if (!$usertoken['verein_id'] > 0) { die('E:Type:0'); } $precord = sql_query('select vid,verband_id,vbundesland,vOrt,vname,vemail,vwebsite,vsoft,vsteel from tverein where vid=' . $usertoken['verein_id'], $dbi); } else { $precord = sql_query("select vid,verband_id,vbundesland,vOrt,vname,vemail,vwebsite,vsoft,vsteel from tverein where vname like '%{$findstr}%' order by verband_id desc,vname asc", $dbi); } if (strlen($findstr) > 0) { $pageheader = 'Ergebniss der Suchanfrage ' . $findstr; } else { $pageheader = 'Liste aller Vereine'; } $aTH = array('Bundesland', 'Verein', 'email', 'WWW', 'Soft', 'Steel'); setPageTitle($pageheader); OpenTable('tblverein'); echo '<div id="lstverein"><table width="100%" cellpadding="2" cellspacing="2">'; echo ArrayToTableHead($aTH); $i = 0; $target = $vereinsdb . '?func=edit&vvid='; $onClick = 'vereinedit(vid)'; while (list($vid, $verband_id, $varea, $vOrt, $vname, $vemail, $vwebsite, $vsoft, $vsteel) = sql_fetch_row($precord, $dbi)) { // $i=$i+1; echo '<tr>' . '<td>' . $imgdetail . ' ' . $varea . '<br>' . $vOrt . '</td>' . '<td><a href="' . $target . $vid . '"><b>' . $vname . '</b></a></td>' . '<td>' . $vemail . '</td>' . '<td><a href="http://' . $vwebsite . '" target="_blank">' . $vwebsite . '</a></td>'; if ($vsoft == 1) { echo '<td>' . $dartgreen . '</td>'; } else { echo '<td></td>'; } if ($vsteel == 1) { echo '<td>' . $dartgreen . '</td>'; } else { echo '<td></td>'; } echo '</tr>'; } # // END WHILE LOOP echo '</table></div>'; CloseTable(); /* debug("Anzahl der Vereine: $i"); $RS=DB_listVereine($dbi,0,$usertoken['realm'],$findstr); $ROWS=RecordsetToClickTable($RS,1,$target."%P1%",0); // OUTPUT echo "<div id=\"lstverein\"><table>$ROWS</table></div>"; */ }
function right_types() { global $dbi; $right_result = sql_query('SELECT a.access_id, a.acactive, a.acdesc FROM tligaaccesscode a ORDER BY a.access_id ASC', $dbi); # Table header $ret = '<table><tr><td class="thead">Id</td><td class="thead">Active</td><td class="thead">Right name</td></tr>'; while (list($id, $acactive, $acdesc) = sql_fetch_row($right_result, $dbi)) { $ret = $ret . '<tr><td>' . $id . '</td><td>' . ($acactive == 1 ? 'Yes' : 'No') . '</td><td>' . $acdesc . '</td></tr>'; } return $ret . '</table>'; }
function quest_edit($type_quest, $id_quest, $back_poll) { $re_quest = sql_query("\r\n\tSELECT type_file, type_class \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_quest_type_poll \r\n\tWHERE type_quest = '" . $type_quest . "'"); if (!mysql_num_rows($re_quest)) { return; } list($type_file, $type_class) = sql_fetch_row($re_quest); require_once $GLOBALS['where_lms'] . '/modules/question_poll/' . $type_file; $quest_obj = eval("return new {$type_class}( {$id_quest} );"); $quest_obj->edit($back_poll); }
function getRoomUserOnline($platform, $room_type, $id_source) { $users_qtxt = "\r\n\t\tSELECT id_room\r\n\t\tFROM " . $GLOBALS["prefix_scs"] . "_rules_room\r\n\t\tWHERE id_source = '" . $id_source . "' AND room_type = '" . $room_type . "'"; list($id_room) = sql_fetch_row(sql_query($users_qtxt)); $users_qtxt = "\r\n\t\tSELECT *\r\n\t\tFROM " . $GLOBALS["prefix_scs"] . "_rules_user\r\n\t\tWHERE id_room='" . $id_room . "'\r\n\t\tORDER BY userid"; $users_q = sql_query($users_qtxt); while ($row = mysql_fetch_array($users_q)) { $res[] = $row["userid"]; } return $res; }
function user_types() { global $dbi; $user_type_result = sql_query('SELECT t.id, t.typename, t.typedescription FROM ttypeuser t ORDER BY t.id ASC', $dbi); # Table header $ret = '<table><tr><td class="thead">Id</td><td class="thead">Type name</td><td class="thead">Description</td></tr>'; while (list($id, $typename, $typedescription) = sql_fetch_row($user_type_result, $dbi)) { $ret = $ret . '<tr><td>' . $id . '</td><td>' . $typename . '</td><td>' . $typedescription . '</td></tr>'; } return $ret . '</table>'; }
function field_specialop($type_field, $id_common, $back) { $re_quest = sql_query("\r\n\tSELECT type_file, type_class \r\n\tFROM " . $GLOBALS['prefix_fw'] . "_field_type \r\n\tWHERE type_field = '" . $type_field . "'"); if (!mysql_num_rows($re_quest)) { return; } list($type_file, $type_class) = sql_fetch_row($re_quest); require_once $GLOBALS['where_framework'] . '/modules/field/' . $type_file; $quest_obj = new $type_class($id_common); $quest_obj->setUrl('index.php?modname=field&op=manage&fo=special'); $quest_obj->specialop($back); }
/** * purpose: resolves a logical mail group into adresses * params: group id * returns: Mail TO: STRING */ function _GetMailAdressForGroup($mgroup_id) { global $dbi; $RET = ''; $resx = sql_query('select G.mgroup_id,mgroupname,user_id,uname,email from tmessagegroup G left JOIN tmessagegroupmember GM on G.mgroup_id=GM.mgroup_id' . ' left JOIN tuser U ON GM.user_id=U.id WHERE G.mgroup_id=' . $mgroup_id, $dbi); while ($a = sql_fetch_row($resx, $dbi)) { $RET = $RET . $a[4] . ', '; } $RET = str_replace('[]', '@', $RET); $RET = str_replace('[at]', '@', $RET); $RET = substr($RET, 0, strlen($RET) - 2); return $RET; }
function sqlValue($sql, $default) { $rs = sql($sql); if ($r = sql_fetch_row($rs)) { if ($r[0] == null) { return $default; } else { return $r[0]; } } else { return $default; } }
/** * @return id_track if create row else false **/ function setTrack($id_reference, $id_resource, $id_user) { $query = "\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_polltrack\r\n\t\tSET id_poll = '" . (int) $id_resource . "',\r\n\t\t\tid_reference = '" . (int) $id_reference . "',\r\n\t\t\tid_user = '******',\r\n\t\t\tdata_attempt = '" . date("Y-m-d H:i:s") . "'"; if (!sql_query($query)) { return false; } list($id_track) = sql_fetch_row(sql_query("SELECT LAST_INSERT_ID()")); if ($id_track) { return $id_track; } else { return false; } }
function view_area() { checkPerm('view'); require_once _lms_ . '/lib/lib.middlearea.php'; $lang =& DoceboLanguage::createInstance('middlearea', 'lms'); $lc =& DoceboLanguage::createInstance('menu_course', 'lms'); $query_menu = "SELECT mo.idModule, mo.default_name, under.my_name\r\n\tFROM %lms_module AS mo\r\n\t\tJOIN %lms_menucourse_under AS under\r\n\tWHERE mo.idModule = under.idModule\r\n\t\tAND mo.module_info IN ('all','user')\r\n\t\tAND mvc_path <> 'elearning/show'\r\n\tORDER BY under.sequence"; $re_menu_voice = sql_query($query_menu); $base_url = 'index.php?modname=middlearea&op=select_permission&load=1&obj_index='; $second_url = 'index.php?modname=middlearea&op=switch_active&obj_index='; $ma = new Man_MiddleArea(); $disabled_list = $ma->getDisabledList(); // Main men $main_menu = ''; while (list($id_m, $default_name, $my_name) = sql_fetch_row($re_menu_voice)) { $main_menu .= '<li>' . '<span>' . Lang::t($default_name, 'menu_over', false, false, $default_name) . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_' . $id_m . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_' . $id_m]) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_' . $id_m . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>'; } $main_menu .= '<li>' . '<span>' . Lang::t('_MESSAGES', 'menu_over') . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_message' . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_message']) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_message' . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>'; $main_menu .= '<li>' . '<span>' . Lang::t('_CUSTOMER_HELP', 'customer_help') . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_help' . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_help']) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_help' . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>'; // Tab list $tab_list = ''; $tab = array('tb_elearning' => Lang::t('_ELEARNING', 'middlearea'), 'tb_home' => Lang::t('_HOME', 'middlearea'), 'tb_label' => Lang::t('_LABELS', 'label'), 'tb_classroom' => Lang::t('_CLASSROOM', 'middlearea'), 'tb_catalog' => Lang::t('_CATALOGUE', 'middlearea'), 'tb_assessment' => Lang::t('_ASSESSMENT', 'middlearea'), 'tb_coursepath' => Lang::t('_COURSEPATH', 'coursepath'), 'tb_games' => Lang::t('_CONTEST', 'middlearea'), 'tb_communication' => Lang::t('_COMMUNICATIONS', 'middlearea'), 'tb_videoconference' => Lang::t('_VIDEOCONFERENCE', 'middlearea'), 'tb_kb' => Lang::t('_CONTENT_LIBRARY', 'middlearea')); if (Get::cfg('enable_plugins', false)) { require_once _adm_ . "/models/PluginAdm.php"; $pluginAdm = new PluginAdm(); $plugins = $pluginAdm->getInstalledPlugins(); foreach ($plugins as $plugin_name) { $tab["tb_" . strtolower($plugin_name)] = ucfirst($plugin_name); } } $query_menu = "SELECT obj_index from %lms_middlearea where obj_index like 'tb_%' ORDER BY sequence"; $re_tablist = sql_query($query_menu); while (list($obj_index) = sql_fetch_row($re_tablist)) { $id = $obj_index; $name = $tab[$id]; $tab_list .= '<li id="' . $id . '">' . '<span>' . $name . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . $id . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list[$id]) ? 'noac' : 'actv') . '" href="' . $second_url . $id . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>'; } // Block List $block_list = ''; $block = array('user_details_full' => Lang::t('_PROFILE', 'profile'), 'credits' => Lang::t('_CREDITS', 'middlearea'), 'career' => Lang::t('_CAREER', 'middlearea'), 'course' => Lang::t('_SUBSCRIBE_COURSE', 'middlearea'), 'news' => Lang::t('_NEWS', 'middlearea')); while (list($id, $name) = each($block)) { $block_list .= '<div class="direct_block">' . '<span>' . $name . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . $id . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list[$id]) ? 'noac' : 'actv') . '" href="' . $second_url . $id . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</div><br/>'; } cout(getTitleArea($lang->def('_MIDDLE_AREA'), 'middlearea') . '<div class="std_block">'); cout('<h2>' . Lang::t('_MAN_MENU', 'menu') . '</h2>' . '<ul class="action-list">' . $main_menu . '</ul>'); cout('<div id="lms_main_container" class="yui-t5">' . '<div class="yui-b">' . '<h2>' . Lang::t('_BLOCKS', 'middlearea') . '</h2>' . $block_list . '</div>' . '<div id="yui-main">' . '<div class="yui-b" id="tablist">' . '<h2>' . Lang::t('_TABS', 'middlearea') . '</h2>' . '<ul class="action-list">' . $tab_list . '</ul>' . '</div>' . '</div>' . '<div class="nofloat"></div>' . '</div>'); cout('</div>'); $js = "\r\n\t<script src=\"http://yui.yahooapis.com/3.9.1/build/yui/yui-min.js\"></script>\r\n\t<script>\r\n\tYUI().use('sortable', function (Y) {\r\n\t var sortable;\r\n\t sortable = new Y.Sortable({\r\n\t container: '#tablist ul',\r\n\t nodes : 'li',\r\n\t opacity : '0.1'\r\n\t });\r\n\r\n sortable.delegate.after('drag:end', function (e) {\r\n\t var node = sortable.delegate.get('currentNode');\r\n\r\n\t // rewind\r\n\t while(node.previous()) {\r\n\t \tnode = node.previous();\r\n}\r\n\t // ciclo\r\n\t a = node.get('id');\r\n\t while(node.next()) {\r\n\t \tnode = node.next();\r\n\t \ta += ','+node.get('id');\r\n\t }\r\n\r\n\t sUrl = 'ajax.adm_server.php?r=middlearea/order&list='+a;\r\n\r\n\t\t var callback = {\r\n\t\t success: function(o) {\r\n\t\t },\r\n\t\t failure:function(o) {\r\n\t\t }\r\n\t\t };\r\n\t\t YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);\r\n\r\n\r\n\t });\r\n });\r\n\r\n\r\n </script>"; cout($js); }
function TreeView_CatView($tdb, $id, $rootname = 'root') { $query_course = "SELECT idCategory, COUNT(*) FROM " . $GLOBALS['prefix_lms'] . "_course GROUP BY idCategory "; $re_course = sql_query($query_course); while ($row = sql_fetch_row($re_course)) { $this->cat_not_empty[$row[0]] = $row[1]; } $user_lvl = Docebo::user()->getUserLevelId(); parent::TreeView($tdb, $id, $rootname); $this->can_add = $user_lvl == ADMIN_GROUP_GODADMIN; $this->can_mod = $user_lvl == ADMIN_GROUP_GODADMIN; $this->can_del = $user_lvl == ADMIN_GROUP_GODADMIN; //require_once(_i18n_.'/lib.lang.php'); }
function finish($uname, $pwd) { global $dbi; $md5_pwd = md5($pwd); $l_result = sql_query("select * from jones_user where uname='{$uname}' and pwd='{$md5_pwd}'", $dbi); if (sql_num_rows($l_result, $dbi) == 0) { $error = "Incorrect username or password"; Header("Location: login.php?error={$error}"); die; } list($uid, $uname, $pwd, $fname, $lname, $email, $privs) = sql_fetch_row($l_result, $dbi); sendCookie($uid, $uname, $pwd, $fname, $lname, $email, $privs); Header("Location: index.php"); }
function printDetails($query, $type) { global $admin, $user, $cookie, $prefix, $dbi, $user_prefix; $result = sql_query($query, $dbi); $numrows = sql_num_rows($result, $dbi); echo "<Br><B>Your " . $type . " : " . $numrows . "</B><HR>"; echo "<table width=\"60%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" . "<tr><td bgcolor=\"#000000\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">" . "</tr><tr>" . "<th height=\"25\" colspan=\"1\" align=\"center\" wrap><font color=\"#28313C\"><strong>Name</strong></font></th>" . "<th height=\"15\" colspan=\"1\" align=\"center\" wrap><font color=\"#28313C\"><strong>UserId</strong></font></th>" . "<th height=\"10\" colspan=\"1\" align=\"center\" wrap><font color=\"#28313C\"><strong>Year</strong></font></th>" . "<th height=\"10\" colspan=\"1\" align=\"center\" wrap><font color=\"#28313C\"><strong>Company</strong></font></th>" . "</tr>"; while (list($name, $username, $gradyear, $company) = sql_fetch_row($result, $dbi)) { $username = "******" . $username . "</a>"; echo "<tr><td class=\"row1\">" . $name . "</td>" . "<td class=\"row2\">" . $username . "</td>" . "<td class=\"row1\">" . $gradyear . "</td>" . "<td class=\"row2\">" . $company . "</td>" . "</tr>"; //echo $name . " [" . $username . "]" . "<BR>"; } echo "</table>"; }
/** * this function create a copy of a question and return the corresponding id * * @return int return the id of the new question if success else return false * * @access public * @author Fabio Pirovano (fabio@docebo.com) */ function copy($new_id_poll, $back_poll = NULL) { list($sel_cat, $quest, $sequence, $page) = sql_fetch_row(sql_query("\r\n\t\tSELECT id_category, title_quest, sequence, page \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\tWHERE id_quest = '" . (int) $this->id . "'")); //insert question $ins_query = "\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t( id_poll, id_category, type_quest, title_quest, sequence, page ) VALUES \r\n\t\t( \t'" . (int) $new_id_poll . "', \r\n\t\t\t'" . (int) $sel_cat . "', \r\n\t\t\t'" . $this->getQuestionType() . "', \r\n\t\t\t'" . mysql_escape_string($quest) . "',\r\n\t\t\t'" . (int) $sequence . "',\r\n\t\t\t'" . (int) $page . "' ) "; if (!sql_query($ins_query)) { return false; } //find id of auto_increment colum list($new_id_quest) = sql_fetch_row(sql_query("SELECT LAST_INSERT_ID()")); if (!$new_id_quest) { return false; } return $new_id_quest; }