当前位置: 首页>>代码示例>>PHP>>正文


PHP cr_unserialize函数代码示例

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


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

示例1: print_filter

 function print_filter(&$mform)
 {
     global $remotedb, $COURSE;
     //$filter_user = optional_param('filter_user',0,PARAM_INT);
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     if ($this->report->type != 'sql') {
         $components = cr_unserialize($this->report->components);
         $conditions = $components['conditions'];
         $userlist = $reportclass->elements_by_conditions($conditions);
     } else {
         $coursecontext = context_course::instance($COURSE->id);
         $userlist = array_keys(get_users_by_capability($coursecontext, 'moodle/user:viewdetails'));
     }
     $useroptions = array();
     $useroptions[0] = get_string('filter_all', 'block_configurable_reports');
     if (!empty($userlist)) {
         list($usql, $params) = $remotedb->get_in_or_equal($userlist);
         $users = $remotedb->get_records_select('user', "id {$usql}", $params);
         foreach ($users as $c) {
             $useroptions[$c->id] = format_string($c->lastname . ' ' . $c->firstname);
         }
     }
     $mform->addElement('select', 'filter_user', get_string('user'), $useroptions);
     $mform->setType('filter_user', PARAM_INT);
 }
开发者ID:adonm,项目名称:learning,代码行数:26,代码来源:plugin.class.php

示例2: print_filter

 function print_filter(&$mform, $data)
 {
     global $DB, $CFG;
     $columns = $DB->get_columns('course');
     $filteroptions = array();
     $filteroptions[''] = get_string('choose');
     $coursecolumns = array();
     foreach ($columns as $c) {
         $coursecolumns[$c->name] = $c->name;
     }
     if (!isset($coursecolumns[$data->field])) {
         print_error('nosuchcolumn');
     }
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     $components = cr_unserialize($this->report->components);
     $conditions = $components['conditions'];
     $courselist = $reportclass->elements_by_conditions($conditions);
     if (!empty($courselist)) {
         if ($rs = $DB->get_recordset_sql('SELECT DISTINCT(' . $data->field . ') as ufield FROM {course} WHERE ' . $data->field . ' <> "" ORDER BY ufield ASC', null)) {
             foreach ($rs as $u) {
                 $filteroptions[base64_encode($u->ufield)] = $u->ufield;
             }
             $rs->close();
         }
     }
     $mform->addElement('select', 'filter_fcoursefield_' . $data->field, get_string($data->field), $filteroptions);
     $mform->setType('filter_courses', PARAM_INT);
 }
开发者ID:nickkoeppen,项目名称:moodle-report_configreports,代码行数:29,代码来源:plugin.class.php

示例3: print_filter

    function print_filter(&$mform) {
        global $remoteDB;

        $reportclassname = 'report_' . $this->report->type;
        $reportclass = new $reportclassname($this->report);

        if ($this->report->type != 'sql') {
            $components = cr_unserialize($this->report->components);
            $conditions = $components['conditions'];

            $userslist = $reportclass->elements_by_conditions($conditions);
        } else {
            $userslist = array_keys($remoteDB->get_records('user'));
        }

        $usersoptions = array();
        $usersoptions[0] = get_string('filter_all', 'block_cobalt_reports');

        if (!empty($userslist)) {
            list($usql, $params) = $remoteDB->get_in_or_equal($userslist);
            $users = $remoteDB->get_records_select('user', "id $usql", $params);

            foreach ($users as $c) {
                $usersoptions[$c->id] = format_string($c->lastname . ' ' . $c->firstname);
            }
        }

        $mform->addElement('select', 'filter_users', get_string('users'), $usersoptions);
        $mform->setType('filter_users', PARAM_INT);
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:30,代码来源:plugin.class.php

示例4: print_filter

 function print_filter(&$mform)
 {
     global $CFG;
     $filter_years = optional_param('filter_years', 0, PARAM_INT);
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     if ($this->report->type != 'sql') {
         $components = cr_unserialize($this->report->components);
         $conditions = $components['conditions'];
         $yearslist = $reportclass->elements_by_conditions($conditions);
     } else {
         $yearslist = true;
         //array_keys(get_records('course'));
     }
     $courseoptions = array();
     $courseoptions[0] = get_string('choose');
     //if(!empty($yearslist)){
     //$years = get_records_select('course','id in ('.(implode(',',$yearslist)).')');
     $years = explode(',', get_string('filteryears_list', 'block_configurable_reports'));
     //print_object($years);die;
     foreach ($years as $c) {
         $courseoptions[$c] = format_string($c);
     }
     //}
     $select =& $mform->addElement('select', 'filter_years', get_string('filteryears', 'block_configurable_reports'), $courseoptions);
     $select->setMultiple(true);
     $mform->setType('filter_years', PARAM_RAW);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:28,代码来源:plugin.class.php

示例5: print_filter

 function print_filter(&$mform)
 {
     global $remotedb, $CFG;
     $filter_yearhebrew = optional_param('filter_yearhebrew', 0, PARAM_RAW);
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     //$yearhebrew = array('תשע'=>'תשע','תשעא'=>'תשעא','תשעב'=>'תשעב','תשעג'=>'תשעג','תשעד'=>'תשעד','תשעה'=>'תשעה');
     foreach (explode(',', get_string('filteryearhebrew_list', 'block_configurable_reports')) as $value) {
         $yearhebrew[$value] = $value;
     }
     if ($this->report->type != 'sql') {
         $components = cr_unserialize($this->report->components);
         $conditions = $components['conditions'];
         $yearhebrewlist = $reportclass->elements_by_conditions($conditions);
     } else {
         $yearhebrewlist = array_keys($yearhebrew);
     }
     $yearhebrewoptions = array();
     $yearhebrewoptions[0] = get_string('filter_all', 'block_configurable_reports');
     if (!empty($yearhebrewlist)) {
         // todo: check that keys of yearhebrew array items are available
         foreach ($yearhebrew as $key => $year) {
             $yearhebrewoptions[$key] = $year;
         }
     }
     $mform->addElement('select', 'filter_yearhebrew', get_string('filteryearhebrew', 'block_configurable_reports'), $yearhebrewoptions);
     $mform->setType('filter_yearhebrew', PARAM_RAW);
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:28,代码来源:plugin.class.php

示例6: definition

 function definition()
 {
     global $DB, $CFG;
     $mform =& $this->_form;
     $report = $this->_customdata['report'];
     $options = array();
     if ($report->type != 'sql') {
         $components = cr_unserialize($this->_customdata['report']->components);
         if (is_array($components) && !empty($components['columns']['elements'])) {
             $columns = $components['columns']['elements'];
             foreach ($columns as $c) {
                 $options[] = $c['summary'];
             }
         }
     } else {
         require_once $CFG->dirroot . '/blocks/configurable_reports/report.class.php';
         require_once $CFG->dirroot . '/blocks/configurable_reports/reports/' . $report->type . '/report.class.php';
         $reportclassname = 'report_' . $report->type;
         $reportclass = new $reportclassname($report);
         $components = cr_unserialize($report->components);
         $config = isset($components['customsql']['config']) ? $components['customsql']['config'] : new stdclass();
         if (isset($config->querysql)) {
             $sql = $config->querysql;
             $sql = $reportclass->prepare_sql($sql);
             if ($rs = $reportclass->execute_query($sql)) {
                 foreach ($rs as $row) {
                     $i = 0;
                     foreach ($row as $colname => $value) {
                         $options[$i] = str_replace('_', ' ', $colname);
                         $i++;
                     }
                     break;
                 }
             }
         }
     }
     $optionsenabled = array(0 => get_string('disabled', 'block_configurable_reports'), 1 => get_string('enabled', 'block_configurable_reports'));
     $mform->addElement('select', 'enabled', get_string('template', 'block_configurable_reports'), $optionsenabled);
     $mform->setDefault('enabled', 0);
     $mform->addElement('htmleditor', 'header', get_string('header', 'block_configurable_reports'));
     $mform->disabledIf('header', 'enabled', 'eq', 0);
     $mform->addHelpButton('header', 'template_marks', 'block_configurable_reports');
     $availablemarksrec = '';
     if ($options) {
         foreach ($options as $o) {
             $availablemarksrec .= "[[{$o}]] => {$o} <br />";
         }
     }
     $mform->addElement('static', 'statictext', get_string('availablemarks', 'block_configurable_reports'), $availablemarksrec);
     $mform->addElement('htmleditor', 'record', get_string('templaterecord', 'block_configurable_reports'));
     $mform->disabledIf('record', 'enabled', 'eq', 0);
     $mform->addElement('htmleditor', 'footer', get_string('footer', 'block_configurable_reports'));
     $mform->disabledIf('footer', 'enabled', 'eq', 0);
     $mform->addHelpButton('footer', 'template_marks', 'block_configurable_reports');
     //$mform->addRule('record', get_string('required'), 'required', null, 'client');
     $mform->setType('header', PARAM_RAW);
     $mform->setType('record', PARAM_RAW);
     $mform->setType('footer', PARAM_RAW);
     $this->add_action_buttons();
 }
开发者ID:adonm,项目名称:learning,代码行数:60,代码来源:form.php

示例7: form_set_data

    function form_set_data(&$cform) {
        global $DB;

        if ($this->form) {
            $fdata = new stdclass;
            $components = cr_unserialize($this->config->components);
            //print_r($components);exit;
            $conditionsconfig = (isset($components['permissions']['config'])) ? $components['permissions']['config'] : new stdclass;

            if (!isset($conditionsconfig->conditionexpr)) {
                $fdata->conditionexpr = '';
                $conditionsconfig->conditionexpr = '';
            }
            $conditionsconfig->conditionexpr = $this->add_missing_conditions($conditionsconfig->conditionexpr);
            $fdata->conditionexpr = $conditionsconfig->conditionexpr;

            if (empty($components['permissions'])) {
                $components['permissions'] = array();
            }

            if (!array_key_exists('config', $components['permissions'])) {
                $components['permissions']['config'] = new StdClass;
            }

            $components['permissions']['config']->conditionexpr = $fdata->conditionexpr;
            $this->config->components = cr_serialize($components);
            $DB->update_record('block_cobalt_reports', $this->config);


            $cform->set_data($fdata);
        }
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:32,代码来源:component.class.php

示例8: print_filter

 function print_filter(&$mform)
 {
     global $remotedb, $CFG;
     $filter_courses = optional_param('filter_metacourses', 0, PARAM_INT);
     $reportclassname = 'report_' . $this->report->type;
     $reportclass = new $reportclassname($this->report);
     if ($this->report->type != 'sql') {
         $components = cr_unserialize($this->report->components);
         $conditions = $components['conditions'];
         $courselist = $reportclass->elements_by_conditions($conditions);
     } else {
         //$courselist = array_keys($remotedb->get_records('course'));                       // Original table
         $courselist = array_keys($remotedb->get_records('meta_course'));
         // meta_course table
     }
     $courseoptions = array();
     $courseoptions[0] = get_string('filter_all', 'block_configurable_reports');
     if (!empty($courselist)) {
         list($usql, $params) = $remotedb->get_in_or_equal($courselist);
         //$courses = $remotedb->get_records_select('course',"id $usql",$params);            // Original
         $courses = $remotedb->get_records_select('meta_course', "id {$usql}", $params);
         // Metacourse
         foreach ($courses as $c) {
             if ($c->name) {
                 $courseoptions[$c->id] = format_string($c->name);
                 // Changed to 'name'
             }
         }
     }
     //$mform->addElement('select', 'filter_courses', get_string('course'), $courseoptions); // Original text in form
     $mform->addElement('select', 'filter_metacourses', 'Meta course', $courseoptions);
     // 'Meta course'
     $mform->setType('filter_metacourses', PARAM_INT);
 }
开发者ID:janmeier,项目名称:metacourse-filter,代码行数:34,代码来源:plugin.class.php

示例9: add_form_elements

    function add_form_elements(&$mform, $components) {
        global $DB, $CFG;

        $components = cr_unserialize($components);
        $options = array();

        if ($this->config->type != 'sql') {
            if (!is_array($components) || empty($components['columns']['elements']))
                print_error('nocolumns');

            $columns = $components['columns']['elements'];

            $calcs = isset($components['calcs']['elements']) ? $components['calcs']['elements'] : array();
            $columnsused = array();
            if ($calcs) {
                foreach ($calcs as $c) {
                    $columnsused[] = $c['formdata']->column;
                }
            }

            $i = 0;
            foreach ($columns as $c) {
                if (!in_array($i, $columnsused))
                    $options[$i] = $c['summary'];
                $i++;
            }
        }
        else {
            require_once($CFG->dirroot . '/blocks/cobalt_reports/report.class.php');
            require_once($CFG->dirroot . '/blocks/cobalt_reports/reports/' . $this->config->type . '/report.class.php');

            $reportclassname = 'report_' . $this->config->type;
            $reportclass = new $reportclassname($this->config);

            $components = cr_unserialize($this->config->components);
            $config = (isset($components['customsql']['config'])) ? $components['customsql']['config'] : new stdclass;

            if (isset($config->querysql)) {

                $sql = $config->querysql;
                $sql = $reportclass->prepare_sql($sql);
                if ($rs = $reportclass->execute_query($sql)) {
                    foreach ($rs as $row) {
                        $i = 0;
                        foreach ($row as $colname => $value) {
                            $options[$i] = str_replace('_', ' ', $colname);
                            $i++;
                        }
                        break;
                    }
                    $rs->close();
                }
            }
        }

        $mform->addElement('header', 'crformheader', get_string('coursefield', 'block_cobalt_reports'), '');
        $mform->addElement('select', 'column', get_string('column', 'block_cobalt_reports'), $options);
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:58,代码来源:component.class.php

示例10: form_set_data

 function form_set_data(&$cform)
 {
     if ($this->form) {
         $fdata = new stdclass();
         $components = cr_unserialize($this->config->components);
         $fdata = isset($components['columns']['config']) ? $components['columns']['config'] : $fdata;
         $cform->set_data($fdata);
     }
 }
开发者ID:nickkoeppen,项目名称:moodle-report_configreports,代码行数:9,代码来源:component.class.php

示例11: form_set_data

 function form_set_data(&$cform)
 {
     if ($this->form) {
         $fdata = new stdclass();
         $components = cr_unserialize($this->config->components);
         $compconfig = isset($components['timeline']['config']) ? $components['timeline']['config'] : new stdclass();
         $cform->set_data($compconfig);
     }
 }
开发者ID:adonm,项目名称:learning,代码行数:9,代码来源:component.class.php

示例12: definition

 function definition()
 {
     global $DB, $USER, $CFG;
     $mform =& $this->_form;
     $options = array();
     $report = $this->_customdata['report'];
     if ($report->type != 'sql') {
         $components = cr_unserialize($this->_customdata['report']->components);
         if (!is_array($components) || empty($components['columns']['elements'])) {
             print_error('nocolumns');
         }
         $columns = $components['columns']['elements'];
         foreach ($columns as $c) {
             if (!empty($c['summary'])) {
                 $options[] = $c['summary'];
             }
         }
     } else {
         require_once $CFG->dirroot . '/blocks/configurable_reports/report.class.php';
         require_once $CFG->dirroot . '/blocks/configurable_reports/reports/' . $report->type . '/report.class.php';
         $reportclassname = 'report_' . $report->type;
         $reportclass = new $reportclassname($report);
         $components = cr_unserialize($report->components);
         $config = isset($components['customsql']['config']) ? $components['customsql']['config'] : new stdclass();
         if (isset($config->querysql)) {
             $sql = $config->querysql;
             $sql = $reportclass->prepare_sql($sql);
             if ($rs = $reportclass->execute_query($sql)) {
                 foreach ($rs as $row) {
                     $i = 0;
                     foreach ($row as $colname => $value) {
                         $options[$i] = str_replace('_', ' ', $colname);
                         $i++;
                     }
                     break;
                 }
                 $rs->close();
             }
         }
     }
     $mform->addElement('header', 'crformheader', get_string('coursefield', 'block_configurable_reports'), '');
     $mform->addElement('select', 'areaname', get_string('pieareaname', 'block_configurable_reports'), $options);
     $mform->addElement('select', 'areavalue', get_string('pieareavalue', 'block_configurable_reports'), $options);
     // New Feature: Select Limit Categories in PIE.
     $limits = array();
     for ($i = 0; $i <= 10; $i++) {
         $limits[$i] = $i;
     }
     $mform->addElement('select', 'limitcategories', get_string('limitcategories', 'block_configurable_reports'), $limits);
     // New Feature: Select Decimals in PIE
     $decimals = array('0' => 0, '1' => 1, '2' => 2);
     $mform->addElement('select', 'decimals', get_string('decimals', 'block_configurable_reports'), $decimals);
     $mform->addElement('checkbox', 'group', get_string('groupvalues', 'block_configurable_reports'));
     // buttons
     $this->add_action_buttons(true, get_string('add'));
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:56,代码来源:form.php

示例13: definition

 function definition()
 {
     global $DB, $USER, $CFG;
     $mform =& $this->_form;
     $options = array(0 => get_string('choose'));
     $report = $this->_customdata['report'];
     if ($report->type != 'sql') {
         $components = cr_unserialize($this->_customdata['report']->components);
         if (!is_array($components) || empty($components['columns']['elements'])) {
             print_error('nocolumns');
         }
         $columns = $components['columns']['elements'];
         foreach ($columns as $c) {
             $options[] = $c['summary'];
         }
     } else {
         require_once $CFG->dirroot . '/blocks/configurable_reports/report.class.php';
         require_once $CFG->dirroot . '/blocks/configurable_reports/reports/' . $report->type . '/report.class.php';
         $reportclassname = 'report_' . $report->type;
         $reportclass = new $reportclassname($report);
         $components = cr_unserialize($report->components);
         $config = isset($components['customsql']['config']) ? $components['customsql']['config'] : new stdclass();
         if (isset($config->querysql)) {
             $sql = $config->querysql;
             $sql = $reportclass->prepare_sql($sql);
             if ($rs = $reportclass->execute_query($sql)) {
                 foreach ($rs as $row) {
                     $i = 1;
                     foreach ($row as $colname => $value) {
                         $options[$i] = str_replace('_', ' ', $colname);
                         $i++;
                     }
                     break;
                 }
                 $rs->close();
             }
         }
     }
     $mform->addElement('header', 'crformheader', get_string('line', 'block_configurable_reports'), '');
     $mform->addElement('select', 'xaxis', get_string('xaxis', 'block_configurable_reports'), $options);
     $mform->addRule('xaxis', null, 'required', null, 'client');
     $mform->addElement('select', 'serieid', get_string('serieid', 'block_configurable_reports'), $options);
     $mform->addRule('serieid', null, 'required', null, 'client');
     $mform->addElement('select', 'yaxis', get_string('yaxis', 'block_configurable_reports'), $options);
     $mform->addRule('yaxis', null, 'required', null, 'client');
     $mform->addElement('checkbox', 'group', get_string('groupseries', 'block_configurable_reports'));
     // buttons
     $this->add_action_buttons(true, get_string('add'));
 }
开发者ID:adonm,项目名称:learning,代码行数:49,代码来源:form.php

示例14: get_all_elements

    function get_all_elements() {
        $elements = array();

        $components = cr_unserialize($this->config->components);

        $config = (isset($components['timeline']['config'])) ? $components['timeline']['config'] : new stdclass();

        if (isset($config->timemode)) {

            $daysecs = 60 * 60 * 24;

            if ($config->timemode == 'previous') {
                $config->starttime = gmmktime() - $config->previousstart * $daysecs;
                $config->endtime = gmmktime() - $config->previousend * $daysecs;
                if (isset($config->forcemidnight)) {
                    $config->starttime = usergetmidnight($config->starttime);
                    $config->endtime = usergetmidnight($config->endtime) + ($daysecs - 1);
                }
            }

            $filter_starttime = optional_param('filter_starttime', 0, PARAM_RAW);
            $filter_endtime = optional_param('filter_endtime', 0, PARAM_RAW);

            if ($filter_starttime and $filter_endtime) {
                $filter_starttime = make_timestamp($filter_starttime['year'], $filter_starttime['month'], $filter_starttime['day']);
                $filter_endtime = make_timestamp($filter_endtime['year'], $filter_endtime['month'], $filter_endtime['day']);

                $config->starttime = usergetmidnight($filter_starttime);
                $config->endtime = usergetmidnight($filter_endtime) + 24 * 60 * 60;
            }


            for ($i = $config->starttime; $i < $config->endtime; $i += $config->interval * $daysecs) {
                $row = new stdclass();
                $row->id = $i;
                $row->starttime = $i;
                $row->endtime = $row->starttime + ($config->interval * $daysecs - 1);
                if ($row->endtime > $config->endtime)
                    $row->endtime = $config->endtime;
                $this->timeline[$row->starttime] = $row;
                $elements[] = $row->starttime;
            }

            if ($config->ordering == 'desc')
                rsort($elements);
        }

        return $elements;
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:49,代码来源:report.class.php

示例15: summary

    function summary($data) {
        global $DB, $CFG;

        if ($this->report->type != 'sql') {
            $components = cr_unserialize($this->report->components);
            if (!is_array($components) || empty($components['columns']['elements']))
                print_error('nocolumns');

            $columns = $components['columns']['elements'];
            $i = 0;
            foreach ($columns as $c) {
                if ($i == $data->column)
                    return $c['summary'];
                $i++;
            }
        }
        else {

            require_once($CFG->dirroot . '/blocks/cobalt_reports/report.class.php');
            require_once($CFG->dirroot . '/blocks/cobalt_reports/reports/' . $this->report->type . '/report.class.php');

            $reportclassname = 'report_' . $this->report->type;
            $reportclass = new $reportclassname($this->report);

            $components = cr_unserialize($this->report->components);
            $config = (isset($components['customsql']['config'])) ? $components['customsql']['config'] : new stdclass;

            if (isset($config->querysql)) {

                $sql = $config->querysql;
                $sql = $reportclass->prepare_sql($sql);
                if ($rs = $reportclass->execute_query($sql)) {
                    foreach ($rs as $row) {
                        $i = 0;
                        foreach ($row as $colname => $value) {
                            if ($i == $data->column)
                                return str_replace('_', ' ', $colname);
                            $i++;
                        }
                        break;
                    }
                    $rs->close();
                }
            }
        }

        return '';
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:48,代码来源:plugin.class.php


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