當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Fn類代碼示例

本文整理匯總了PHP中Fn的典型用法代碼示例。如果您正苦於以下問題:PHP Fn類的具體用法?PHP Fn怎麽用?PHP Fn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Fn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Fn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。