function index() { load('string'); $post_startTime = $this->_post('start', ''); $post_endTime = $this->_post('end', ''); if (isHave($post_startTime) && isHave($post_endTime)) { return jumpTo(U('feedback/index', getSearchUrl(array('start' => $post_startTime, 'end' => $post_endTime)))); } $feedbackConfig = C('steward/service_log'); $today = date('Y-m-d', TIME); $type_id = $this->_getid('fbtype', 0); // 反馈类型 $status_id = $this->_getid('fbresult', 0); //处理结果 $worker_uid = $this->_getid('worker_uid', 0); // 发布小管家的uid $startTime = $this->_get('start', ''); //选择反馈对应时间的A点 $endTime = $this->_get('end', ''); //选择反馈对应时间的B点 $ctStartTime = $this->_get('ctstart', ''); //选择反馈插入数据库时间的A点 $ctEndTime = $this->_get('ctend', ''); //选择反馈插入数据库时间的b点 $p = $this->_getid('p', 1); $pageShow = 20; $query = array(); if ($type_id) { $query['type_id'] = $type_id - 1; } if ($status_id) { $query['status_id'] = $status_id - 1; } if ($worker_uid) { $query['worker_uid'] = $worker_uid; } if (isHave($startTime) && isHave($endTime)) { $query['fb_time[>=]'] = inTime($startTime); $query['fb_time[<=]'] = inTime($endTime); } if (isHave($ctStartTime) && isHave($ctEndTime)) { $query['ct_time[>=]'] = inTime($ctStartTime); $query['ct_time[<=]'] = inTime($ctEndTime) + 60 * 60 * 24 - 1; } $rs = D('serviceLog')->where($query)->page($p, $pageShow)->order('ct_time DESC')->findAll(); $total = D('serviceLog')->getTotal(); $fb_types = $feedbackConfig['type']; $fb_status = $feedbackConfig['status']; foreach ($rs as $key => $val) { $rs[$key]['fb_time'] = outTime($val['fb_time'], 2); $rs[$key]['ct_time'] = outTime($val['ct_time']); $rs[$key]['worker_name'] = parent::_getAdminName($val['worker_uid']); $rs[$key]['type_text'] = $fb_types[$val['type_id']]['name']; $rs[$key]['status_text'] = $fb_status[$val['status_id']]; } $this->assign(array('types' => $feedbackConfig['type'], 'status' => $feedbackConfig['status'], 'today' => $today, 'rs' => $rs, 'pageShow' => $pageShow, 'total' => $total, 'p' => $p, 'type_id' => $type_id, 'status_id' => $status_id, 'startTime' => $startTime, 'endTime' => $endTime, 'ctStartTime' => $ctStartTime, 'ctEndTime' => $ctEndTime)); $this->display(); }
function index() { if (parent::_checkIsAdmin()) { //访问统计数据展示 $p = $this->_getid('p', 1); $startTime = $this->_get('stime', '', 'urldecode'); //开始时间 $endTime = $this->_get('etime', '', 'urldecode'); //结束时间 $recordId = $this->_getid('id', ''); // $rs = array(); $data = array(); $code = setEnocde(array('a' => 0, 's' => 1, 'city_id' => steadmin::$adminInfo['city_id'])); $url = U('steward/wxapi/index') . '?token=' . $code; $code = urldecode($code); V('db/mongo'); $db = mongoApi::getInstance(); $pageShow = 20; $where = array(); $sort = array('infotime' => -1); if ($startTime && $endTime) { if ($startTime == $endTime) { $endTimeDay = 60 * 60 * 24 - 1; } else { $endTimeDay = 0; } $where['infotime'] = array('$gte' => inTime($startTime), '$lte' => inTime($endTime) + $endTimeDay); } if ($startTime) { $_GET['stime'] = urlencode($startTime); } else { unset($_GET['stime']); } if ($endTime) { $_GET['etime'] = urlencode($endTime); } else { unset($_GET['etime']); } if (!$recordId) { unset($_GET['id']); } if ($recordId) { $where['record_id'] = $recordId; } $count = $db->table('steadminLog')->where($where)->count(); $rsLog = $db->table('steadminLog')->where($where)->order($sort)->limit($pageShow)->skip(($p - 1) * $pageShow)->findAll(); $this->assign(array('rs' => $rs, 'data' => $data, 'url' => $url, 'token' => md5($code . VCODE), 'p' => $p, 'recordId' => $recordId, 'total' => $count, 'rsLog' => $rsLog, 'pageShow' => $pageShow, 'startTime' => $startTime, 'endTime' => $endTime)); $this->display(); } else { jumpTo(U('index/index')); } }
function index() { if (!$this->_checkLogin(true)) { jumpTo(U('login/index')); } if (parent::_checkIsAdmin() && steadmin::$adminInfo['isAdmin']) { jumpTo(U('home/index')); } else { $this->assign(array('group' => C('steward/admin', 'group'))); $this->display('index'); } }
protected function _checkLogin($returnBool = false) { if (steadmin::$adminInfo['user_id']) { return true; } else { if ($returnBool) { return false; } elseif (isAjax()) { return $this->JsonReturn('必须登录后才能进行此操作'); } else { jumpTo(U('login/index')); } return $returnBool ? false : jumpTo(U('login/index')); } }
function modscorm() { checkPerm('mod'); require_once _lms_ . '/lib/lib.coursereport.php'; require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.table.php'; // XXX: Initializaing $id_report = Get::req('id_report', DOTY_INT, 0); $lang =& DoceboLanguage::createInstance('coursereport', 'lms'); $out =& $GLOBALS['page']; $out->setWorkingZone('content'); // XXX: undo if (isset($_POST['undo'])) { jumpTo('index.php?modname=coursereport&op=coursereport'); } // XXX: Retrive all colums (test and so), and set it if ($id_report == 0) { $info_report = array('id_report' => importVar('id_report', true, 0), 'title' => importVar('title'), 'max_score' => importVar('max_score', true), 'required_score' => importVar('required_score', true), 'weight' => importVar('weight', true), 'show_to_user' => importVar('show_to_user', false, 'true'), 'use_for_final' => importVar('use_for_final', false, 'true'), 'source_of' => '', 'id_source' => '0'); } elseif (!isset($_POST['save'])) { $query_report = "\r\n\t\tSELECT id_report, title, max_score, required_score, weight, show_to_user, use_for_final, source_of, id_source\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "' AND id_report = '" . $id_report . "'\r\n\t\t\t\tAND source_of = 'activity' AND id_source = '0'"; $info_report = sql_fetch_assoc(sql_query($query_report)); } $page_title = array('index.php?modname=coursereport&op=coursereport' => $lang->def('_COURSEREPORT', 'menu_course'), strip_tags($lang->def('_ADD_ACTIVITY'))); $out->add(getTitleArea($page_title, 'coursereport') . '<div class="std_block">' . getBackUi('index.php?modname=coursereport&op=coursereport', $lang->def('_BACK'))); // XXX: Save input if needed if (isset($_POST['save']) && is_numeric($_POST['id_source'])) { $report_man = new CourseReportManager(); // check input if ($_POST['titolo'] == '') { $_POST['titolo'] = $lang->def('_NOTITLE'); } //MODIFICHE NUOVISSIMISSIME $query_report = "\r\n\t\tSELECT *\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_scorm_items\r\n\t\tWHERE idscorm_item=" . $_POST['id_source']; //echo $query_report; $risultato = sql_query($query_report); $titolo2 = sql_fetch_assoc($risultato); // if module title is equals to main title don't append it if ($titolo2['title'] != $_POST['titolo']) { $_POST['titolo'] = $_POST['titolo'] . " - " . addslashes($titolo2['title']); } $_POST['title'] = $_POST['titolo']; $re_check = $report_man->checkActivityData($_POST); if (!$re_check['error']) { if ($id_report == 0) { $numero = $report_man->getNextSequence(); $query_ins_report = "\r\n\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\t\t\t\t( id_course, title, max_score, required_score, weight, show_to_user, use_for_final, source_of, id_source, sequence ) VALUES (\r\n\t\t\t\t\t'" . $_SESSION['idCourse'] . "',\r\n\t\t\t\t\t'" . $_POST['title'] . "',\r\n\t\t\t\t\t'0',\r\n\t\t\t\t\t'0',\r\n\t\t\t\t\t'" . $_POST['weight'] . "',\r\n\t\t\t\t\t'" . $_POST['show_to_user'] . "',\r\n\t\t\t\t\t'" . $_POST['use_for_final'] . "',\r\n\t\t\t\t\t'" . $_POST['source_of'] . "',\r\n\t\t\t\t\t'" . $_POST['id_source'] . "',\r\n\t\t\t\t\t'" . $numero . "'\r\n\t\t\t\t)"; echo $query_ins_report; $re = sql_query($query_ins_report); } else { $query_upd_report = "\r\n\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\t\t\t\tSET title = '" . $_POST['title'] . "',\r\n\t\t\t\t\tweight = '" . $_POST['weight'] . "',\r\n\t\t\t\t\tmax_score = '0',\r\n\t\t\t\t\trequired_score = '0',\r\n\t\t\t\t\tuse_for_final = '" . $_POST['use_for_final'] . "',\r\n\t\t\t\t\tshow_to_user = '******'show_to_user'] . "'\r\n\t\t\t\tWHERE id_course = '" . $_POST['id_course'] . "' AND id_report = '" . $id_report . "'"; $re = sql_query($query_upd_report); } Util::jump_to('index.php?modname=coursereport&op=coursereport&result=' . ($re ? 'ok' : 'err')); } else { $out->add(getErrorUi($re_check['message'])); } } if (isset($_POST['filtra'])) { if ($_POST['source_of'] == 'scoitem' && is_numeric($_POST['title'])) { //richiesto lo scorm item $query_report = "\r\n\t\t\tSELECT title\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_organization\r\n\t\t\tWHERE objectType='scormorg' and idResource=" . (int) $_POST['title'] . ""; $risultato = sql_query($query_report); $titolo = sql_fetch_assoc($risultato); $titolo = $titolo['title']; $query_report = "\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_scorm_items\r\n\t\t\tWHERE idscorm_organization=" . (int) $_POST['title'] . "\r\n\t\t\tORDER BY idscorm_item"; //echo $query_report; $risultato = sql_query($query_report); while ($scorm = sql_fetch_assoc($risultato)) { $array_scorm[$scorm['idscorm_item']] = $scorm['title']; } $out->add(Form::openForm('addscorm', 'index.php?modname=coursereport&op=addscorm') . Form::openElementSpace() . Form::getHidden('id_report', 'id_report', $id_report) . Form::getDropdown($lang->def('_SCORM_ITEM'), 'id_source', 'id_source', $array_scorm, $info_report['id_source']) . Form::getTextfield($lang->def('_WEIGHT'), 'weight', 'weight', '11', $info_report['weight']) . Form::getDropdown($lang->def('_SHOW_TO_USER'), 'show_to_user', 'show_to_user', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['show_to_user']) . Form::getDropdown($lang->def('_USE_FOR_FINAL'), 'use_for_final', 'use_for_final', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['use_for_final']) . Form::getHidden('title', 'title', $_POST['title']) . Form::getHidden('source_of', 'source_of', $_POST['source_of']) . Form::getHidden('titolo', 'titolo', $titolo) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>'); } } // XXX: Write in output $page_title = array('index.php?modname=coursereport&op=coursereport' => $lang->def('_COURSEREPORT', 'menu_course'), strip_tags($lang->def('_ADD_ACTIVITY'))); if (!isset($_POST['filtra'])) { $query_report = "\r\n\t\t\tSELECT idResource,title\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_organization\r\n\t\t\tWHERE objectType='scormorg' and idCourse=" . $_SESSION['idCourse'] . ""; $risultato = sql_query($query_report); while ($scorm = sql_fetch_assoc($risultato)) { $array_scorm[$scorm['idResource']] = $scorm['title']; } $out->add(Form::openForm('addscorm', 'index.php?modname=coursereport&op=addscorm') . Form::openElementSpace() . Form::getHidden('id_report', 'id_report', $id_report) . Form::getDropdown($lang->def('_TITLE'), 'title', 'title', $array_scorm, $info_report['title']) . Form::getRadioSet($lang->def('_SCORE'), 'source_of', 'source_of', array("Scorm Item" => 'scoitem'), 'scoitem') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filtra', 'filtra', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>'); } }
function logout() { steadmin::setUserLoginOut(); jumpTo(U('login/index')); }
$link_redstone_dust = jumpTo("Item","331","Redstone Dust"); $link_seeds = jumpTo("Item","295","Seeds"); $link_shears = jumpTo("Item","359","Shears"); $link_sheep = jumpTo("Mob","14","Sheep"); $link_skeleton = jumpTo("Mob","17","Skeleton"); $link_spiders = jumpTo("Mob","19","Spiders"); $link_slimes = jumpTo("Mob","18","Slimes"); $link_wither = jumpTo("Mob","26","Wither"); $link_wolf = jumpTo("Mob","23","Wolf"); $link_wolves = jumpTo("Mob","23","Wolves"); $link_villager = jumpTo("Mob","22","Villager"); $link_villagers = jumpTo("Mob","22","Villagers"); $link_zombie = jumpTo("Mob","24","Zombie"); $link_zombies = jumpTo("Mob","24","Zombies"); $link_zombie_villager = jumpTo("Mob","28","Zombie Villager"); $link_zombie_pigman = jumpTo("Mob","29","Zombie Pigman"); $link_potions = '<a href="javascript:dBoots.navClick(\'potions\');">Potions</a>'; /* Utilities */ function isWeekend() { $dw = date("w"); /* Whitelist Off - Friday, Sat, Sunday */ if ($dw == 5 || $dw == 6 || $dw == 0) { return true; } else { /* Override here on holidays and so forth. */ return false; #return false; } }
376 => array("id" => "376", "name" => "Spider Eye", "name_b" => "Fermented", "type" => "items", "bg_pos" => "-352px -608px", "recipe" => "0,0,0,375,353,39,0,0,0", "desc" => "Used with <a onclick='dBoots.jumpToItem(this,379);'>Brewing Stand</a> to create Weakness ".$link_potions.".", "stackable" => true, "more_info" => "Fermented_Spider_Eye"), 19 => array("id" => "19", "name" => "Sponge", "type" => "terrain", "bg_pos" => "-224px -384px", "recipe" => "-sponge_wet,263", "desc" => "Decorative block used to soak up water.", "stackable" => true, "more_info" => "Sponge"), "-sponge_wet" => array("id" => "-sponge_wet", "name" => "Sponge", "name_b" => "Wet", "type" => "terrain", "bg_pos" => "-128px -960px", "desc" => "Decorative block dropped by Elder Guardians. May be dried in a ".$link_furnace." to create a <a onclick='dBoots.jumpToItem(this,19);'>Sponge</a>.", "stackable" => true, "more_info" => "Wet_Sponge"), 280 => array("id" => "280", "name" => "Stick", "type" => "items", "bg_pos" => "-64px -448px", "recipe" => "0,0,0,0,5,0,0,5,0", "amt" => "4", "desc" => "Crafting <a onclick='dBoots.jumpToItem(this,50);'>Torches</a>, tools, weapons, <a onclick='dBoots.jumpToItem(this,65);'>Ladders</a>, <a onclick='dBoots.jumpToItem(this,66);'>Rails</a>, and <a onclick='dBoots.jumpToItem(this,323);'>Signs</a>.", "stackable" => true, "more_info" => "Stick"), 1 => array("id" => "1", "name" => "Stone", "type" => "terrain", "bg_pos" => "-320px -416px", "recipe" => "4,263", "desc" => "Common terrain block.", "footnote" => $common_fuel_sources, "stackable" => true, "more_info" => "Stone"), 275 => array("id" => "275", "name" => "Stone Axe", "type" => "items", "bg_pos" => "-128px -96px", "recipe" => "4,4,0,4,280,0,0,280,0", "desc" => "Wood-chopping tool.", "more_info" => "Axe"), 77 => array("id" => "77", "name" => "Stone Button", "type" => "others", "bg_pos" => "0 -192px", "recipe" => "0,0,0,0,1,0,0,1,0", "desc" => "Sends a charge to an object when pressed.", "stackable" => true, "more_info" => "Button"), 98 => array("id" => "98", "name" => "Stone Brick", "type" => "items", "bg_pos" => "-160px -544px", "recipe" => "0,0,0,1,1,0,1,1,0", "amt" => "4", "stackable" => true, "more_info" => "Stone_Brick"), 291 => array("id" => "291", "name" => "Stone Hoe", "type" => "items", "bg_pos" => "-224px -448px", "recipe" => "4,4,0,0,280,0,0,280,0", "desc" => $txt_hoe, "more_info" => "Hoe"), 274 => array("id" => "274", "name" => "Stone Pickaxe", "type" => "items", "bg_pos" => "-160px -32px", "recipe" => "4,4,4,0,280,0,0,280,0", "desc" => "Block breaking, mining tool.", "more_info" => "Pickaxe"), 273 => array("id" => "273", "name" => "Stone Shovel", "type" => "items", "bg_pos" => "-320px -160px", "recipe" => "0,4,0,0,280,0,0,280,0", "desc" => "Digging tool. ".$shovel_usage, "more_info" => "Shovel"), 44 => array("id" => "44", "name" => "Stone Slab", "type" => "terrain", "bg_pos" => "-224px -160px", "recipe" => "0,0,0,0,0,0,1,1,1", "amt" => "6", "desc" => "Solid half-block. Alternate slab types may be crafted from Stone, Sandstone, Wooden Planks, Cobblestone, or Brick.", "stackable" => true, "more_info" => "Slabs"), 43 => array("id" => "43", "name" => "Stone Slab", "name_b" => "Double", "type" => "terrain", "bg_pos" => "-416px -128px", "desc" => "Solid double half-block. Alternate slab types may be crafted from Stone, Sandstone, Wooden Planks, Cobblestone, or Brick.", "stackable" => true, "more_info" => "Slabs"), 272 => array("id" => "272", "name" => "Stone Sword", "type" => "items", "bg_pos" => "-64px -160px", "recipe" => "0,4,0,0,4,0,0,280,0", "desc" => "Weapon which causes <strong>3.5</strong> damage points.", "more_info" => "Sword"), 109 => array("id" => "109", "name" => "Stone Stairs", "type" => "items", "bg_pos" => "-320px -544px", "recipe" => "98,0,0,98,98,0,98,98,98", "amt" => "4", "desc" => "Allows elevation change without jumping.", "stackable" => true, "more_info" => "Stairs"), 287 => array("id" => "287", "name" => "String", "type" => "items", "bg_pos" => "-448px -352px", "source" => $link_spiders.", ".jumpTo("Mob","21","Spider Jockeys").", ".$txt_gen_chest, "desc" => "Crafting of <a onclick='dBoots.jumpToItem(this,261);'>Bows</a>, <a onclick='dBoots.jumpToItem(this,346);'>Fishing Rods</a>, and ".jumpTo("Item","420","Leads").".", "stackable" => true, "more_info" => "String"), 353 => array("id" => "353", "name" => "Sugar", "type" => "items", "bg_pos" => "-352px -64px", "recipe" => "0,0,0,0,338,0,0,0,0", "desc" => "Crafting of <a onclick='dBoots.jumpToItem(this,354);'>Cake</a> and <a onclick='dBoots.jumpToItem(this,376);'>Fermented Spider Eye</a>.", "stackable" => true, "more_info" => "Sugar"), 338 => array("id" => "338", "name" => "Sugar Cane", "type" => "items", "bg_pos" => "-352px -192px", "source" => "Sugar Cane", "desc" => "Source of <a onclick='dBoots.jumpToItem(this,353);'>Sugar</a> and crafting of <a onclick='dBoots.jumpToItem(this,339);'>Paper</a>.", "stackable" => true, "more_info" => "Sugar_Cane"), 175 => array("id" => "175", "name" => "Sunflower", "type" => "item", "bg_pos" => "-448px -736px", "desc" => $txt_decor, "stackable" => true, "more_info" => "Flower#Sunflower"), 46 => array("id" => "46", "name" => "TNT", "type" => "terrain", "bg_pos" => "-32px -192px", "recipe" => "289,12,289,12,289,12,289,12,289", "desc" => "Explosions.", "stackable" => true, "more_info" => "TNT"), 50 => array("id" => "50", "name" => "Torch", "type" => "terrain", "bg_pos" => "-416px -480px", "recipe" => "0,0,0,0,263,0,0,280,0", "amt" => "4", "desc" => "Light-source item.", "footnote" => $common_fuel_sources, "stackable" => true, "more_info" => "Torch"), 96 => array("id" => "96", "name" => "Trapdoor", "name_b" => "Wooden", "type" => "terrain", "bg_pos" => "-352px -352px", "recipe" => "0,0,0,5,5,5,5,5,5", "amt" => "2", "desc" => "Horizontal door which may be opened by player.", "stackable" => true, "more_info" => "Trapdoor"), 167 => array("id" => "167", "name" => "Trapdoor", "name_b" => "Iron", "type" => "terrain", "bg_pos" => "-96px -864px", "recipe" => "0,0,0,265,265,0,265,265,0", "desc" => "Horizontal door which may be opened by redstone power.", "stackable" => true, "more_info" => "Trapdoor"), 131 => array("id" => "131", "name" => "Tripwire Hook", "type" => "items", "bg_pos" => "-352px -640px", "recipe" => "0,265,0,0,280,0,0,5,0", "desc" => "Used with <a onclick='dBoots.jumpToItem(this,287);'>String</a> and another Tripwire Hook to create a switch across a gap.", "stackable" => true, "more_info" => "Tripwire_Hook"), 3804 => array("id" => "38_4", "name" => "Tulip", "name_b" => "Red", "type" => "item", "bg_pos" => "-256px -736px", "desc" => $txt_decor, "stackable" => true, "more_info" => "Flower#Tulip"), 3805 => array("id" => "38_5", "name" => "Tulip", "name_b" => "Orange", "type" => "item", "bg_pos" => "-190px -736px", "desc" => $txt_decor, "stackable" => true, "more_info" => "Flower#Tulip"), 3806 => array("id" => "38_6", "name" => "Tulip", "name_b" => "White", "type" => "item", "bg_pos" => "-288px -736px", "desc" => $txt_decor, "stackable" => true, "more_info" => "Flower#Tulip"), 3807 => array("id" => "38_7", "name" => "Tulip", "name_b" => "Pink", "type" => "item", "bg_pos" => "-224px -736px", "desc" => $txt_decor, "stackable" => true, "more_info" => "Flower#Tulip"), 106 => array("id" => "106", "name" => "Vines", "type" => "items", "bg_pos" => "-98px -544px", "desc" => "Decorative non-solid wall block. Collectable with ".$link_shears.".", "stackable" => true, "more_info" => "Vines"), /*68 => array("id" => "68", "name" => "Wall Sign", "type" => "others", "bg_pos" => "-224px -480px", "desc" => "Decorative non-solid block which may contain text.", "more_info" => "Sign"), */ 8 => array("id" => "8", "name" => "Water", "type" => "terrain", "bg_pos" => "-448px -224px", "desc" => "Fluid which may be placed with <a onclick='dBoots.jumpToItem(this,325);'>Bucket</a>.", "more_info" => "Water"),
function generateCode() { require_once _base_ . '/lib/lib.form.php'; $step = Get::req('step', DOTY_INT, 1); $id_code_group = Get::req('id_code_group', DOTY_INT, 0); cout(getTitleArea(Lang::t('_CODE', 'code')) . '<div class="std_block">'); switch ($step) { case 1: cout(Form::openForm('code_generation_step_1', 'index.php?modname=code&op=generate_code&step=2') . Form::getHidden('id_code_group', 'id_code_group', $id_code_group) . Form::openElementSpace() . Form::getTextfield(Lang::t('_HOW_MANY', 'code'), 'code_number', 'code_number', 255, '') . Form::getCheckbox(Lang::t('_UNLIMITED_USE', 'code'), 'unlimited_use', 'unlimited_use', '1') . '<br />' . Form::getCheckbox('0-9', 'use_number', 'use_number', '1', true) . Form::getCheckbox('a-z', 'use_low_letter', 'use_low_letter', '1', true) . Form::getCheckbox('A-Z', 'use_high_letter', 'use_high_letter', '1', true) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('generate', 'generate', Lang::t('_GENERATE', 'code')) . Form::getButton('undo_group', 'undo_group', Lang::t('_UNDO', 'code')) . Form::closeButtonSpace() . Form::closeForm()); break; case 2: require_once $GLOBALS['where_framework'] . '/lib/lib.code.php'; $code_man = new CodeManager(); $code_number = Get::req('code_number', DOTY_INT, 0); $unlimited_use = Get::req('unlimited_use', DOTY_INT, 0); $use_number = Get::req('use_number', DOTY_INT, 0); $use_low_letter = Get::req('use_low_letter', DOTY_INT, 0); $use_high_letter = Get::req('use_high_letter', DOTY_INT, 0); if ($unlimited_use == 0) { $unlimited_use = false; } else { $unlimited_use = true; } if ($use_number == 0) { $use_number = false; } else { $use_number = true; } if ($use_low_letter == 0) { $use_low_letter = false; } else { $use_low_letter = true; } if ($use_high_letter == 0) { $use_high_letter = false; } else { $use_high_letter = true; } if (!$use_number && !$use_low_letter && !$use_high_letter) { jumpTo('index.php?modname=code&op=generate_code&id_code_group=' . $id_code_group . '&err=no_char'); } $all_code = $code_man->getAllCode(); for ($i = 1; $i <= $code_number; $i++) { $control = true; while ($control) { $new_code = ''; if ($use_number && $use_low_letter && $use_high_letter) { for ($a = 0; $a < 10; $a++) { $seed = mt_rand(0, 15); if ($seed > 10) { $new_code .= mt_rand(0, 9); } elseif ($seed > 5) { $new_code .= chr(mt_rand(65, 90)); } else { $new_code .= chr(mt_rand(97, 122)); } } } elseif ($use_number && $use_low_letter) { for ($a = 0; $a < 10; $a++) { $seed = mt_rand(0, 10); if ($seed > 5) { $new_code .= mt_rand(0, 9); } else { $new_code .= chr(mt_rand(65, 90)); } } } elseif ($use_number && $use_high_letter) { for ($a = 0; $a < 10; $a++) { $seed = mt_rand(0, 10); if ($seed > 5) { $new_code .= mt_rand(0, 9); } else { $new_code .= chr(mt_rand(97, 122)); } } } elseif ($use_low_letter && $use_high_letter) { for ($a = 0; $a < 10; $a++) { $seed = mt_rand(0, 10); if ($seed > 5) { $new_code .= chr(mt_rand(65, 90)); } else { $new_code .= chr(mt_rand(97, 122)); } } } else { if ($use_number) { for ($a = 0; $a < 10; $a++) { $new_code .= mt_rand(0, 9); } } if ($use_low_letter) { for ($a = 0; $a < 10; $a++) { $new_code .= chr(mt_rand(65, 90)); } } if ($use_high_letter) { for ($a = 0; $a < 10; $a++) { $new_code .= chr(mt_rand(97, 122)); } } } if (array_search($new_code, $all_code) === false) { $all_code[] = $new_code; $code_man->addCode($new_code, $id_code_group, $unlimited_use); $control = false; } } } Util::jump_to('index.php?modname=code&op=list'); break; } cout('</div>'); }
function showError($msg, $url = 'back', $isAutoGo = false) { if ($msg == 404) { jumpTo(404); } return showMsg($msg, $url, '', $isAutoGo, '错误信息'); }
public function import_csv() { if (!$this->permissions['subscribe_course']) { $this->render('invalid', array('message' => $this->_getErrorMessage('no permission'), 'back_url' => 'index.php?r=' . $this->link_course . '/show')); return; } require_once _base_ . '/lib/lib.form.php'; //Step info $step = Get::req('step', DOTY_INT, 1); if (isset($_POST['next'])) { $step++; } if (isset($_POST['back'])) { $step--; } if (isset($_POST['undo'])) { $step = 0; } switch ($step) { case '0': Util::jump_to('index.php?r=' . $this->link_course . '/show'); break; case '1': $course_info = $this->model->getCourseInfoForSubscription(); $course_name = ($course_info['code'] !== '' ? '[' . $course_info['code'] . '] ' : '') . $course_info['name']; $params = array('table' => $tb, 'id_course' => $this->id_course, 'id_date' => $this->id_date, 'id_edition' => $this->id_edition, 'course_name' => $course_name, 'model' => $this->model); $this->render('import_csv_step_1', $params); break; case '2': require_once _lms_ . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.upload.php'; require_once _adm_ . '/lib/lib.import.php'; $separator = Get::req('import_separator', DOTY_MIXED, ','); $first_row_header = Get::req('import_first_row_header', DOTY_BOOL, false); $import_charset = Get::req('import_charset', DOTY_MIXED, 'UTF-8'); $docebo_course = new DoceboCourse($this->id_course); $level_idst =& $docebo_course->getCourseLevel($this->id_course); if (count($level_idst) == 0 || $level_idst[1] == '') { $level_idst =& $docebo_course->createCourseLevel($this->id_course); } $back_url = 'index.php?r=' . $this->link . '/show&id_course=' . $this->id_course . '&id_edition=' . $this->id_edition . '&id_date=' . $this->id_date; // ----------- file upload ----------------------------------------- if ($_FILES['file_import']['name'] == '') { $_SESSION['last_error'] = Lang::t('_FILEUNSPECIFIED'); jumpTo($back_url . '&err=_file_unspecified'); } else { $path = '/appCore/'; $savefile = mt_rand(0, 100) . '_' . time() . '_' . $_FILES['file_import']['name']; if (!file_exists($GLOBALS['where_files_relative'] . $path . $savefile)) { sl_open_fileoperations(); if (!sl_upload($_FILES['file_import']['tmp_name'], $path . $savefile)) { sl_close_fileoperations(); $_SESSION['last_error'] = Lang::t('_ERROR_UPLOAD', 'subscribe'); jumpTo($back_url . '&err=_err_upload'); } sl_close_fileoperations(); } else { $_SESSION['last_error'] = Lang::t('_ERROR_UPLOAD', 'subscribe'); jumpTo($back_url . '&err=_err_upload'); } } $src = new DeceboImport_SourceCSV(array('filename' => $GLOBALS['where_files_relative'] . $path . $savefile, 'separator' => $separator, 'first_row_header' => $first_row_header, 'import_charset' => $import_charset)); $src->connect(); $user_added = 0; $user_error = 0; $user_not_needed = 0; $id_user_added = array(); $counter = 0; $course_info = $this->model->getCourseInfoForSubscription(); $can_subscribe = true; $max_num_subscribe = $course_info['max_num_subscribe']; $subscribe_method = $course_info['subscribe_method']; if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { $limited_subscribe = Docebo::user()->preference->getAdminPreference('admin_rules.limit_course_subscribe'); $max_subscribe = Docebo::user()->preference->getAdminPreference('admin_rules.max_course_subscribe'); $direct_subscribe = Docebo::user()->preference->getAdminPreference('admin_rules.direct_course_subscribe'); if ($limited_subscribe == 'on') { $limited_subscribe = true; } else { $limited_subscribe = false; } if ($direct_subscribe == 'on') { $direct_subscribe = true; } else { $direct_subscribe = false; } } else { $limited_subscribe = false; $max_subscribe = 0; $direct_subscribe = true; } if (is_array($row = $src->get_first_row()) && !empty($row)) { $user_info = $this->acl_man->getUser(false, $row[0]); if ($user_info) { $id_user = $user_info[ACL_INFO_IDST]; if ($can_subscribe) { require_once _lms_ . '/lib/lib.course.php'; $docebo_course = new DoceboCourse($this->id_course); $level_idst =& $docebo_course->getCourseLevel($this->id_course); if (count($level_idst) == 0 || $level_idst[1] == '') { $level_idst =& $docebo_course->createCourseLevel($this->id_course); } if (!$direct_subscribe) { $waiting = 1; } else { $waiting = 0; } if (!$limited_subscribe || $max_subscribe) { //$this->acl_man->addToGroup($level_idst['3'], $id_user); $this->_addToCourseGroup($level_idst['3'], $id_user); if ($this->model->subscribeUser($id_user, '3', $waiting)) { $user_added++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_CORRECT'; $user_subscribed[] = $id_user; $max_subscribe--; } else { $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idUser = '******'" . " AND idCourse = '" . $this->id_course . "'"; list($control) = sql_fetch_row(sql_query($query)); if ($control) { $user_not_needed++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_NOT_NEEDED'; } else { $user_error++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_OPERATION_FAILURE'; $this->acl_man->removeFromGroup($level_idst['3'], $id_user); } } } } } else { $user_error++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_OPERATION_FAILURE'; } $counter++; } while (is_array($row = $src->get_next_row()) && !empty($row)) { $user_info = $this->acl_man->getUser(false, $row[0]); if ($user_info) { $id_user = $user_info[ACL_INFO_IDST]; if ($can_subscribe) { require_once _lms_ . '/lib/lib.course.php'; $docebo_course = new DoceboCourse($this->id_course); $level_idst =& $docebo_course->getCourseLevel($this->id_course); if (count($level_idst) == 0 || $level_idst[1] == '') { $level_idst =& $docebo_course->createCourseLevel($this->id_course); } if (!$direct_subscribe) { $waiting = 1; } else { $waiting = 0; } if (!$limited_subscribe || $max_subscribe) { //$this->acl_man->addToGroup($level_idst['3'], $id_user); $this->_addToCourseGroup($level_idst['3'], $id_user); if ($this->model->subscribeUser($id_user, '3', $waiting)) { $user_added++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_CORRECT'; $user_subscribed[] = $id_user; $max_subscribe--; } else { $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idUser = '******'" . " AND idCourse = '" . $this->id_course . "'"; list($control) = sql_fetch_row(sql_query($query)); if ($control) { $user_not_needed++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_NOT_NEEDED'; } else { $user_error++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_OPERATION_FAILURE'; $this->acl_man->removeFromGroup($level_idst['3'], $id_user); } } } } } else { $user_error++; $id_user_added[$counter]['id_user'] = $row[0]; $id_user_added[$counter]['status'] = '_OPERATION_FAILURE'; } $counter++; } $src->close(); unset($row); require_once _base_ . '/lib/lib.table.php'; $type_h = array('align_center', 'align_center', 'align_center', 'align_center'); $cont_h = array(Lang::t('_USERNAME', 'subscribe'), Lang::t('_LASTNAME', 'subscribe'), Lang::t('_FIRSTNAME', 'subscribe'), Lang::t('_INSER_STATUS', 'subscribe')); $tb = new Table(false, Lang::t('_USER_SUBSCRIBED', 'subscribe'), Lang::t('_USER_SUBSCRIBED', 'subscribe')); $tb->addHead($cont_h, $type_h); while (list(, $id_user_added_detail) = each($id_user_added)) { $cont = array(); $user_info = $this->acl_man->getUser(false, $id_user_added_detail['id_user']); $cont[] = $this->acl_man->relativeId($user_info[ACL_INFO_USERID]); $cont[] = $user_info[ACL_INFO_FIRSTNAME]; $cont[] = $user_info[ACL_INFO_LASTNAME]; $cont[] = Lang::t($id_user_added_detail['status'], 'subscribe'); $tb->addBody($cont); } sl_open_fileoperations(); sl_unlink($GLOBALS['where_files_relative'] . $path . $savefile); sl_close_fileoperations(); $course_info = $this->model->getCourseInfoForSubscription(); $course_name = ($course_info['code'] !== '' ? '[' . $course_info['code'] . '] ' : '') . $course_info['name']; $params = array('table' => $tb, 'id_course' => $this->id_course, 'id_date' => $this->id_date, 'id_edition' => $this->id_edition, 'course_name' => $course_name, 'back_link' => getBackUi('index.php?r=' . $this->link . '/show&id_course=' . $this->id_course . '&id_edition=' . $this->id_edition . '&id_date=' . $this->id_date, Lang::t('_BACK', 'subscribe'))); $this->render('import_csv_step_2', $params); break; } }
function render_potion_rows($potion_type) { $splash_notice_li = '<div class="footnote">Add <a onclick=\'dBoots.jumpToItem(this,289,"potion");\'>Gunpowder</a> to any potion, in a '.jumpTo("Item","379","Brewing Stand").', to convert it to a <a href="http://minecraft.gamepedia.com/Splash_Potion">Splash Potion</a>.</div>'; foreach ($potion_type as $potion) { $desc_markup = isset($potion["desc"]) && $potion["desc"] != "" ? '<div class="desc">'.$potion["desc"].'</div>' : false; $name_b_markup = isset($potion["name_b"]) ? ' <span class="soft">('.$potion["name_b"].')</span>' : false; $row_title_name = isset($potion["name_b"]) ? str_replace(" ","_",strtolower($potion["name"]."_".$potion["name_b"])) : str_replace(" ","_",strtolower($potion["name"])); $stackable_markup = '<div class="source"><span class="soft">Stackable:</span> No</div>'; $ingredients_markup = isset($potion["ingredients"]) ? '<div class="line"><span class="soft">Ingredients:</span> '.$potion["ingredients"].'</div>' : false; if($potion["name"] != "") { echo '<li id="potion_',$potion["id"],'" class="potion"><div class="row_item_container" title="'.$potion["name"].' - Minecraft"><span class="potion_icon" style="background-position:'.$potion["bg_pos"],';"></span><h2 id="',$row_title_name,'">',$potion["name"],$name_b_markup,'</h2></div> <div class="content" id="potion_content_',$potion["id"],'" onclick="_stopProp(event);"> ',$desc_markup,$ingredients_markup,$stackable_markup,$splash_notice_li,' <a onclick="dBoots.openMore(event,\'',$potion["more_info"],'\');" class="more_info">More Info</a></div></li>'; } } }
/** * 列表 */ public function index() { parent::_authUser(array(1, 2, 5, 6, 7, 8, 9)); $title = $this->_get('q'); //关键字搜索 $st = $this->_get('st', 'order_sn'); //关键字搜索 $deal = $this->_get('deal', ''); //分组查看 $orderType = $this->_getid('order_type', 0); //类别 $serviceId = $this->_getid('service_id', 0); //服务社 $villageId = $this->_getid('village_id', 0); //小区 $orderSource = $this->_getid('order_source', 0); //客户端 $uid = $this->_getid('uid', 0); //商圈 $startTime = $this->_get('stime', ''); //开始时间 $endTime = $this->_get('etime', ''); //结束时间 $status = $this->_getid('status', 0); //状态 $p = $this->_getid('p', 1); $searchType = array('order_sn' => 'order_sn', 'phone' => 'phone', 'username' => 'username'); $dealAction = array('service' => array('status' => array(1, 3, 4, 5, 13), 'arrive_date[<=]' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))), 'finance' => array('status' => array(9, 10))); //报表页面每页显示数量为100 if ($deal == 'report') { jumpTo(U('report/today')); } $where = array(); if ($deal && isset($dealAction[$deal])) { $where = $dealAction[$deal]; } if (isset($_GET['q']) && !$_GET['q']) { unset($_GET['q']); } if ($deal == 'service') { $pageShow = 80; } else { $pageShow = 20; } if ($title && $st == 'user') { $user = D('member')->field('uid')->where(array('nickname' => $title))->findAll(false); if ($user) { $uid = array(); foreach ($user as $v) { $uid[] = $v['uid']; } $title = ''; } } elseif ($title && $st == 'uid') { $uid = $title; $title = ''; } if ($title && isset($searchType[$st])) { $where['LIKE'] = array($searchType[$st] => parent::safeSearch($title)); } if ($orderType) { $where['order_type'] = $orderType - 1; } if ($serviceId) { $where['service_id'] = $serviceId; } if ($villageId) { $where['village_id'] = $villageId; } if ($orderSource) { $where['order_source'] = $orderSource - 1; } if ($uid) { $where['uid'] = $uid; } if ($startTime && $endTime) { $where['arrive_date[>=]'] = inTime($startTime); $where['arrive_date[<=]'] = inTime($endTime) + 60 * 60 * 24 - 1; } if ($status) { $where['status'] = $status - 1; } if (parent::_checkIsPresident()) { //社长 $where['service_id'] = steadmin::$adminInfo['service_id']; } elseif (!parent::_checkIsAdmin()) { showError('抱歉,暂时无法查看所属订单'); } $rs = M('ste_order')->where($where)->page($p, $pageShow)->order('order_id DESC')->findAll(); $total = M('ste_order')->getTotal(); // z(M('ste_shop')->getAllSql()); // z($rs); if ($rs) { foreach ($rs as $k => $v) { $userName = getUser($v['uid']); $rs[$k]['userName'] = $userName ? $userName : $v['username']; $rs[$k]['villageName'] = parent::getVillageName($v['village_id']); $rs[$k]['serviceName'] = isset($this->serviceData[$v['service_id']]) ? $this->serviceData[$v['service_id']]['stitle'] : ''; } } $lastOrderId = M('ste_order')->order('order_id DESC')->getField('order_id'); // $this->steSetting['order_status'][1] = '<span class="red">已支付</span>'; $this->assign(array('pageShow' => $pageShow, 'rs' => $rs, 'total' => $total, 'p' => $p, 'lastOrderId' => $lastOrderId, 'service_id' => $serviceId, 'order_type' => $orderType, 'startTime' => $startTime, 'endTime' => $endTime, 'title' => $title, 'status' => $status, 'orderSource' => $orderSource, 'service' => $this->serviceData, 'setting' => $this->steSetting, 'setOrderStaus' => $this->setOrderStatus)); $this->display(); }