• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Fn类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Fn的典型用法代码示例。如果您正苦于以下问题:PHP Fn类的具体用法?PHP Fn怎么用?PHP Fn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Fn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     self::$_db = Fn::db();
     self::$_data = array();
     $this->load->model('cron/report/subject_report/common_model');
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:7,代码来源:choose_learn_choose_exam_model.php


示例2: get_group_type_list

    /**
     * 按学科ID,父ID,读取信息提取方式列表
     *          
     * @param   int       学科ID
     * @param   int       上级ID
     * @return  array
     */
    public static function get_group_type_list($pid = 0, $subject_id = 0, $relate_num = TRUE, $relate_child = false)
    {
        static $result = array();
        $hash = $subject_id . '-' . $pid;
        if (isset($result[$hash])) {
            return $result[$hash];
        }
        $list = array();
        $sql = <<<EOT
SELECT * FROM rd_group_type WHERE pid = {$pid}
EOT;
        if ($subject_id) {
            $sql .= " AND subject_id = {$subject_id}";
        }
        $rows = Fn::db()->fetchAll($sql);
        foreach ($rows as $row) {
            $list[$row['id']] = $row;
        }
        if ($relate_num) {
            foreach ($list as &$val) {
                $val = self::get_group_type_num($val);
            }
        }
        if ($relate_child) {
            foreach ($list as &$val) {
                $val['childlist'] = array_values(self::get_group_type_list($val['id'], $val['subject_id'], false));
            }
        }
        $result[$hash] = $list;
        return $result[$hash];
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:38,代码来源:GroupType.php


示例3: beforeAction

 protected function beforeAction($action)
 {
     $this->_controller = $action->getController()->getId();
     $this->_action = $action->getId();
     $this->returnurl = Fn::url_login_current();
     $token = FCookie::get("auth");
     $now = time();
     list($uid, $email, $timeout) = explode("\t", FHelper::auth_code($token, 'DECODE', FF_SALT));
     if ($uid) {
         $userInfo = $this->getUserinfo($uid);
         if ($userInfo['user']['id']) {
             if ($token == $userInfo['user']['token']) {
                 if ($now < $timeout) {
                     $this->userInfo = $userInfo['info'];
                     $this->user = $userInfo['user'];
                     if ($timeout - $now < 60 * 2) {
                         $timeout = time() + 60 * 15;
                         $token = FHelper::auth_code("{$uid}\t{$email}\t{$timeout}", 'ENCODE', FF_SALT);
                         FCookie::set('auth', $token, 60 * 15);
                         $attr = array('token' => $token);
                         $user_model = new User();
                         $user_model->updateByPk($uid, $attr);
                     }
                     //                        $timeout =  time()+60 *15;
                     //                        $token = FHelper::auth_code("$uid\t$email\t$timeout", 'ENCODE', FF_SALT);
                     //                        FCookie::set('auth', $token);
                 }
             }
         }
     }
     return true;
 }
开发者ID:niujie123,项目名称:myself,代码行数:32,代码来源:FController.php


示例4: report

    public function report($exam_id)
    {
        $sql1 = <<<EOT
SELECT count(1) as 'count' 
from rd_student rs,rd_exam_place_student reps , rd_exam_place rep 
where rep.exam_pid='{$exam_id}' and rep.place_id=reps.place_id and rs.uid=reps.uid
EOT;
        $sql2 = <<<EOT
SELECT rs.exam_ticket,CONCAT(rs.last_name,rs.first_name) as xname 
from rd_student rs,rd_exam_place_student reps , rd_exam_place rep 
where rep.exam_pid='{$exam_id}' and rep.place_id=reps.place_id and rs.uid=reps.uid
EOT;
        $result1 = Fn::db()->fetchRow($sql1);
        // 读取数据
        if ($result1['count'] > 0) {
            $sql3 = "SELECT exam_name FROM rd_exam WHERE exam_id={$exam_id}";
            $row = Fn::db()->fetchRow($sql3);
            $title = $row['exam_name'] . '.xls';
            $data = array();
            $data['list'] = $this->db->query($sql2)->result_array();
            $header = array('准考证号', '姓名');
            $excel_model = new ExcelModel();
            $excel_model->addHeader($header);
            $excel_model->addBody($data['list']);
            $excel_model->download($title);
        } else {
            echo '暂无学生,请先添加学生';
        }
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:29,代码来源:kyxm.php


示例5: schools

    public function schools()
    {
        $schools = array();
        $sql = <<<EOT
SELECT school_id, school_name FROM rd_school
EOT;
        $where = array();
        $bind = array();
        if ($keyword = trim($this->input->post('keyword'))) {
            $where[] = 'school_name LIKE ?';
            $bind[] = '%' . $keyword . '%';
        }
        if ($grade_id = intval($this->input->post('grade_id'))) {
            $grade_period = get_grade_period($grade_id);
            if ($grade_period) {
                $where[] = 'grade_period LIKE ?';
                $bind[] = '%' . $grade_period . '%';
            }
        }
        if ($where) {
            $sql .= ' WHERE ' . implode(' AND ', $where);
        }
        $schools = Fn::db()->fetchAll($sql, $bind);
        echo json_encode($schools);
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:25,代码来源:common.php


示例6: delarray

 private static function delarray($dbName, $array, $is_export_student)
 {
     // 处理传入进来的数组
     $tableList = array();
     foreach ($array as $tables) {
         if ($tables == '*') {
             // 所有的表(获得表名时不能按常规方式来组成一个数组)
             $sql = "SELECT table_name, table_type \n                        FROM information_schema.tables \n                        WHERE table_schema = '{$dbName}'";
             $stmt = Fn::db()->query($sql);
             while ($item = $stmt->fetch(PDO_DB::FETCH_ASSOC)) {
                 if (strtolower($item['table_type']) == 'view') {
                     $tableList['view'][] = $item['table_name'];
                 } else {
                     if (!$is_export_student && (is_int(strpos($item['table_name'], 'student')) || is_int(strpos($item['table_name'], 'summary')))) {
                         continue;
                     }
                     $tableList['table'][] = $item['table_name'];
                 }
             }
         } else {
             $tableList['table'] = $array;
             break;
         }
     }
     return $tableList;
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:26,代码来源:Dbmanage.php


示例7: get_type_list

    /**
     * 考试类型列表
     *          
     * @return  array
     */
    public static function get_type_list()
    {
        $sql = <<<EOT
SELECT * FROM rd_interview_type ORDER BY pid ASC
EOT;
        $rows = Fn::db()->fetchAll($sql);
        $list = array();
        foreach ($rows as $row) {
            if ($row['pid']) {
                $list[$row['pid']]['children'][$row['type_id']] = $row;
            } else {
                $list[$row['type_id']] = $row;
            }
        }
        // 分级排序
        $result = array();
        foreach ($list as $row) {
            $result[$row['type_id']] = $row;
            if (!empty($row['children'])) {
                $result = $result + $row['children'];
                unset($result[$row['type_id']]['children']);
            }
        }
        return $result;
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:30,代码来源:InterviewType.php


示例8: getHTML

 public function getHTML()
 {
     if (Config::get('debug')) {
         return $this->html;
     } else {
         return Fn::minifyHTML($this->html);
     }
 }
开发者ID:nikolai-katkov,项目名称:pearl,代码行数:8,代码来源:View.php


示例9: get_average

 /**
  * 获取平均值
  *
  * @param array $param 查询条件
  * @param string $field 查询字段
  * @return array 数据结果集
  */
 public static function get_average($param, $field)
 {
     PDO_DB::build_where($param, $where_sql, $bind);
     $sql = "SELECT AVG({$field}) AS {$field} FROM rd_interview_result";
     if ($where_sql) {
         $sql .= " WHERE {$where_sql}";
     }
     return Fn::db()->fetchRow($sql, $bind);
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:16,代码来源:InterviewResult.php


示例10: each

 public static function each($view, $collection, $item = 'item', array $scope = array())
 {
     if (Fn::iterable($collection)) {
         $tmpl = $tmpl = Ant::init()->fromFile($view);
         foreach ($collection as $single) {
             $scope[$item] = $single;
             echo $tmpl->assign($scope)->draw();
         }
     }
 }
开发者ID:gitter-badger,项目名称:ant-1,代码行数:10,代码来源:Parser.php


示例11: get_average

    /**
     * 获取平均值
     *
     * @param array $param 查询条件
     * @param string $field 查询字段
     * @return array 数据结果集
     */
    public static function get_average($param, $field)
    {
        PDO_DB::build_where($param, $where_sql, $bind);
        $sql = <<<EOT
SELECT AVG({$field}) AS {$field} FROM rd_ruidabei_result
EOT;
        if ($where_sql) {
            $sql .= " WHERE " . $where_sql;
        }
        return Fn::db()->fetchRow($sql, $bind);
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:18,代码来源:RuidabeiResult.php


示例12: insert

 /**
  * 添加 生成考试期次学生的成绩任务
  */
 public function insert($data)
 {
     if (empty($data['exam_pid'])) {
         return false;
     }
     $data['c_time'] = time();
     $data['status'] = 0;
     $exam_ticket_maprule = ExamModel::get_exam($data['exam_pid'], 'exam_ticket_maprule');
     if ($exam_ticket_maprule > 0) {
         $data['status'] = 1;
     }
     return Fn::db()->replace('rd_cron_task_exam_result', $data);
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:16,代码来源:cron_exam_result_model.php


示例13: get_admin_log

    public static function get_admin_log($log_info = '', $item = '*')
    {
        if ($log_info == '') {
            return FALSE;
        }
        $sql = <<<EOT
SELECT {$item} FROM rd_admin_log WHERE log_info = ?
EOT;
        $row = Fn::db()->fetchRow($sql, $log_info);
        if ($item && isset($row[$item])) {
            return $row[$item];
        } else {
            return $row;
        }
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:15,代码来源:AdminLog.php


示例14: get_question

    /**
     * 读取一个试题
     */
    public static function get_question($id = 0, $item = '*')
    {
        if ($id == 0) {
            return FALSE;
        }
        $sql = <<<EOT
SELECT {$item} FROM rd_interview_question WHERE id = {$id}
EOT;
        $row = Fn::db()->fetchRow($sql);
        if ($item && isset($row[$item])) {
            return $row[$item];
        } else {
            return $row;
        }
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:18,代码来源:InterviewQuestion.php


示例15: index

 /**
  * 控制界面首页
  */
 public function index($exam_pid = 0)
 {
     Fn::ajax_call($this, 'regenerateExamRecord', 'regenerateExamResults', 'endPlaceExam', 'regenerateSummaryReportData', 'regenerateReport', 'removeCronTaskReport');
     $exam_pid = intval($exam_pid);
     $param['exam_pid'] = 0;
     $param['exam_isfree'] = 0;
     $examlist = ExamModel::get_exam_list_all($param);
     $exam = array();
     if ($exam_pid > 0) {
         $exam = ExamModel::get_exam($exam_pid);
     }
     if (!$exam) {
         $exam = current($examlist);
     }
     $db = Fn::db();
     /////////////////////////考试记录是否生成/////////////
     $sql = "SELECT uid_data FROM rd_cron_task_place_student_paper ctps\n                LEFT JOIN rd_exam_place  ep ON ep.place_id = ctps.place_id\n                WHERE ep.exam_pid ={$exam['exam_id']} AND ctps.status=2";
     $uid_arr = $db->fetchCol($sql);
     $paper_count = 0;
     foreach ($uid_arr as $item) {
         $paper_count += count(json_decode($item));
     }
     $sql = "SELECT COUNT(*) FROM rd_exam_place_student eps\n               LEFT JOIN rd_exam_place ep ON ep.place_id = eps.place_id\n               WHERE ep.exam_pid = {$exam['exam_id']}";
     $student_count = $db->fetchOne($sql);
     if ($paper_count == $student_count) {
         $data['paper_status'] = true;
         //考试记录是否完全生成
     } else {
         $data['paper_status'] = false;
     }
     /////////////////////////////////////////
     $sql = "SELECT status FROM rd_cron_task_exam_result \n            WHERE exam_pid = {$exam['exam_id']}";
     $data['cter_status'] = $db->fetchOne($sql);
     //////////////////////////////////////////
     $sql = "SELECT DISTINCT(status) FROM rd_cron_task_report ctr \n                LEFT JOIN rd_evaluate_rule er ON er.id = ctr.rule_id \n                WHERE exam_pid =  {$exam['exam_id']}";
     $data['ctr_status'] = $db->fetchCol($sql);
     ////////////////////////////////////////
     $data['exam'] = $exam;
     $data['demo_exam'] = $this->demo_exam_list();
     $data['examlist'] = $examlist;
     $data['place'] = ExamPlaceModel::get_exam_place($exam_pid, 'MAX(end_time) as end_time');
     $data['crontaskexamresult'] = ReportCommandModel::cronTaskExamResultInfo($exam['exam_id']);
     $data['evaluerulelist'] = ReportCommandModel::cronTaskReportLists($exam['exam_id']);
     $this->load->view('report_command/index', $data);
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:48,代码来源:report_command.php


示例16: get_skills

 /**
  * 读取列表
  * @param   int $subject_id = 0 学科ID,为0表示不限学科
  * @return  map<int, variant>   获取某个学科(或不限学科)的所有技能列表
  */
 public static function get_skills($subject_id = 0)
 {
     static $result = array();
     $hash =& $subject_id;
     if (isset($result[$hash])) {
         return $result[$hash];
     }
     $sql = 'SELECT * FROM rd_skill';
     $list = array();
     if ($subject_id) {
         $sql .= ' WHERE subject_id = ' . $subject_id;
     }
     $rows = Fn::db()->fetchAll($sql);
     foreach ($rows as $row) {
         $list[$row['id']] = $row;
     }
     $result[$hash] = $list;
     return $list;
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:24,代码来源:Skill.php


示例17: getPayList

 static function getPayList($orderby = 'order_id', $order = 'DESC', $limit = 30, array $query_conds = array(), &$statinfo = array())
 {
     $where = "AND o.`pay_status`=2";
     if (isset($query_conds['seeall']) && $query_conds['seeall']) {
         $where = "";
     }
     $where_cond = '';
     if (isset($query_conds['target']) && $query_conds['target']) {
         if (is_numeric($query_conds['target'])) {
             $where_cond .= " AND o.`player_id`=" . $query_conds['target'];
         } else {
             $where_cond .= " AND p.`truename` like '%%" . D()->escape_string($query_conds['target']) . "%%'";
         }
     }
     if (isset($query_conds['start_date']) && $query_conds['start_date']) {
         $starttime = strtotime($query_conds['start_date'] . DAY_BEGIN);
         $where_cond .= " AND o.`add_time`>=" . $starttime;
     }
     if (isset($query_conds['end_date']) && $query_conds['end_date']) {
         $endtime = strtotime($query_conds['end_date'] . DAY_END);
         $where_cond .= " AND o.`add_time`<=" . $endtime;
     }
     $where = $where . $where_cond;
     $sql = "SELECT o.*,u.nickname,u.logo,p.truename AS player_name\n\t\t\t\t\t\t\t\tFROM `{order_info}` o INNER JOIN `{member}` u ON o.user_id=u.uid\n\t\t\t\t\t\t\t\t     INNER JOIN `{player}` p ON o.player_id=p.player_id\n\t\t\t\t       WHERE 1 {$where}\n\t\t           ORDER BY `%s` %s";
     $sqlcnt = "SELECT COUNT(o.order_id) AS rcnt FROM {order_info} o INNER JOIN `{player}` p ON o.player_id=p.player_id WHERE 1 {$where}";
     $result = D()->pager_query($sql, $limit, $sqlcnt, 0, $orderby, $order)->fetch_array_all();
     $statinfo = ['total_pay' => 0, 'current_pay' => 0];
     $statinfo['total_pay'] = D()->query("SELECT SUM(o.`goods_amount`) AS total_pay FROM `{order_info}` o INNER JOIN `{player}` p ON o.player_id=p.player_id WHERE o.`pay_status`=2 {$where_cond}")->result();
     if (empty($statinfo['total_pay'])) {
         $statinfo['total_pay'] = 0;
     }
     if (!empty($result)) {
         foreach ($result as &$it) {
             $it['order_status_name'] = Fn::order_status($it['order_status']);
             $it['pay_status_name'] = Fn::pay_status($it['pay_status']);
             if ($it['pay_status'] == PS_PAYED) {
                 $statinfo['current_pay'] += $it['goods_amount'];
             }
         }
     }
     return $result;
 }
开发者ID:GavinLai,项目名称:SimMatch,代码行数:42,代码来源:Pay_Model.php


示例18: init_distribution_paper_manual

 /**
  * 手动给参加考试的学生分配试卷及试题
  *
  * @return void
  */
 public function init_distribution_paper_manual()
 {
     set_time_limit(0);
     $db = Fn::db();
     $this->load->model('cron/cron_place_student_paper_model', 'init_model');
     /* 手动指定考场 */
     /* $places = array(57,58,59,60); */
     $places = array(60);
     $place_list = array();
     /* 获取考场学生 */
     foreach ($places as $key => $value) {
         $sql = "SELECT uid FROM rd_exam_place_student WHERE place_id='{$value}'";
         $place_list[$value]['uids'] = $db->fetchCol($sql);
     }
     $place_uids = array();
     $place_ids = array();
     foreach ($place_list as $place_id => $place) {
         $exam_pid = $place['exam_pid'];
         foreach ($place['uids'] as $uid) {
             //给学生分配试卷
             $result = $this->init_model->init_test_paper($place_id, $uid);
             if ($result) {
                 $place_ids[$exam_pid][$place_id][] = $uid;
             }
         }
     }
     //给考场学生分配试题
     if ($place_ids) {
         foreach ($place_ids as $exam_pid => $place) {
             foreach ($place as $place_id => $uids) {
                 $uids = array_unique($uids);
                 $this->init_model->init_test_question($exam_pid, $place_id, $uids);
             }
         }
     }
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:41,代码来源:exam_place_student_paper.php


示例19: __construct

 public function __construct()
 {
     parent::__construct();
     self::$_db = Fn::db();
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:5,代码来源:summary_student_model.php


示例20: initSyncZmossExamResults

 /**
  * 执行考试成绩同步
  */
 public static function initSyncZmossExamResults()
 {
     $db = Fn::db();
     $sql = "SELECT er_examid, er_zmoss_examid FROM t_exam_relate\n                WHERE er_flag > 0 AND er_flag < 3 AND er_exampid > 0 limit 5";
     $list = $db->fetchAll($sql);
     if (!$list) {
         return false;
     }
     foreach ($list as $item) {
         $db->update('t_exam_relate', array('er_flag' => 100), 'er_examid = ? AND er_zmoss_examid = ?', array($item['er_examid'], $item['er_zmoss_examid']));
     }
     foreach ($list as $item) {
         $flag = self::syncZmossExamResults($item['er_examid'], $item['er_zmoss_examid']);
         if ($flag) {
             $bind = array('er_flag' => 3);
         } else {
             $bind = array('er_flag' => 2);
         }
         $db->update('t_exam_relate', $bind, 'er_examid = ? AND er_zmoss_examid = ?', array($item['er_examid'], $item['er_zmoss_examid']));
     }
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:24,代码来源:Zmoss.php



注:本文中的Fn类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Folder类代码示例发布时间:2022-05-23
下一篇:
PHP Flyspray类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap