本文整理汇总了PHP中cr_serialize函数的典型用法代码示例。如果您正苦于以下问题:PHP cr_serialize函数的具体用法?PHP cr_serialize怎么用?PHP cr_serialize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cr_serialize函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_process_data
function form_process_data(&$cform) {
global $DB;
if ($this->form) {
$data = $cform->get_data();
$components = cr_unserialize($this->config->components);
$components['timeline']['config'] = $data;
$this->config->components = cr_serialize($components);
$DB->update_record('block_cobalt_reports', $this->config);
}
}
示例2: form_process_data
function form_process_data($cform)
{
if ($this->form) {
$data = $cform->get_data();
$components = cr_unserialize($this->config->components);
$components['timeline']['config'] = $data;
$this->config->components = cr_serialize($components);
update_record('block_configurable_reports_report', $this->config);
}
}
示例3: form_process_data
function form_process_data(&$cform)
{
if ($this->form) {
$data = $cform->get_data();
// cr_serialize() will add slashes
$components = cr_unserialize($this->config->components);
$components['columns']['config'] = $data;
$this->config->components = cr_serialize($components);
$DB->update_record('report_configreports', $this->config);
}
}
示例4: form_process_data
function form_process_data(&$cform)
{
global $DB;
if ($this->form) {
$data = $cform->get_data();
// cr_serialize() will add slashes
$components = cr_unserialize($this->config->components);
$components['template']['config'] = $data;
$this->config->components = cr_serialize($components);
$DB->update_record('block_configurable_reports', $this->config);
}
}
示例5: redirect
} else {
redirect(new moodle_url('/blocks/configurable_reports/editcomp.php', array('id' => $id, 'comp' => $comp)));
exit;
}
}
}
}
} else {
$allelements = cr_unserialize($report->components);
$uniqueid = random_string(15);
while (strpos($report->components, $uniqueid) !== false) {
$uniqueid = random_string(15);
}
$cdata = array('id' => $uniqueid, 'formdata' => new stdclass(), 'pluginname' => $pname, 'pluginfullname' => $pluginclass->fullname, 'summary' => $pluginclass->summary(new stdclass()));
$allelements[$comp]['elements'][] = $cdata;
$report->components = cr_serialize($allelements);
if (!$DB->update_record('block_configurable_reports', $report)) {
print_error('errorsaving');
} else {
redirect(new moodle_url('/blocks/configurable_reports/editcomp.php', array('id' => $id, 'comp' => $comp)));
exit;
}
}
$title = format_string($report->name) . ' ' . get_string($comp, 'block_configurable_reports');
$navlinks = array();
$navlinks[] = array('name' => get_string('managereports', 'block_configurable_reports'), 'link' => $CFG->wwwroot . '/blocks/configurable_reports/managereport.php?courseid=' . $report->courseid, 'type' => 'title');
$navlinks[] = array('name' => $title, 'link' => $CFG->wwwroot . '/blocks/configurable_reports/editcomp.php?id=' . $id . '&comp=' . $comp, 'type' => 'title');
$navlinks[] = array('name' => get_string($pname, 'block_configurable_reports'), 'link' => null, 'type' => 'title');
$navigation = build_navigation($navlinks);
$PAGE->set_title($title);
$PAGE->set_heading($title);
示例6: execute
function execute($data, $row, $user, $courseid, $starttime = 0, $endtime = 0) {
global $DB, $CFG;
if (!$report = $DB->get_record('block_cobalt_reports', array('id' => $data->reportid)))
print_error('reportdoesnotexists', 'block_cobalt_reports');
require_once($CFG->dirroot . '/blocks/cobalt_reports/report.class.php');
require_once($CFG->dirroot . '/blocks/cobalt_reports/reports/' . $report->type . '/report.class.php');
if (!isset($this->reportcache[$row->id])) {
$reportclassname = 'report_' . $report->type;
$reportclass = new $reportclassname($report);
// Delete conditions - TODO
// Add new condition
// User report -> New condition "User courses"
// Course report -> New condition "Course users"
if ($this->report->type == 'users') {
$reportclass->currentuser = $row;
$reportclass->starttime = $starttime;
$reportclass->endtime = $endtime;
if ($report->type == 'courses') {
$components = cr_unserialize($reportclass->config->components);
$newplugin = array('pluginname' => 'currentusercourses', 'fullname' => 'currentusercourses', 'formdata' => new stdclass);
$components['conditions']['elements'][] = $newplugin;
$components['conditions']['config']->conditionexpr = $this->fix_condition_expr($components['conditions']['config']->conditionexpr, count($components['conditions']['elements']));
$reportclass->config->components = cr_serialize($components);
}
} else if ($this->report->type == 'courses') {
$reportclass->currentcourseid = $row->id;
$reportclass->starttime = $starttime;
$reportclass->endtime = $endtime;
if ($report->type == 'users') {
$components = cr_unserialize($reportclass->config->components);
$roles = $DB->get_records('role');
$rolesid = array_keys($roles);
$formdata = new stdclass;
$formdata->roles = $rolesid;
$newplugin = array('pluginname' => 'usersincurrentcourse', 'fullname' => 'usersincurrentcourse', 'formdata' => $formdata);
$components['conditions']['elements'][] = $newplugin;
if (!empty($components['conditions']['config'])) {
$components['conditions']['config']->conditionexpr = $this->fix_condition_expr($components['conditions']['config']->conditionexpr, count($components['conditions']['elements']));
}
$reportclass->config->components = cr_serialize($components);
}
} else if ($this->report->type == 'timeline') {
$reportclass->starttime = $row->starttime;
$reportclass->endtime = $row->endtime;
} else if ($this->report->type == 'categories') {
$reportclass->starttime = $starttime;
$reportclass->endtime = $endtime;
if ($report->type == 'courses') {
$components = cr_unserialize($reportclass->config->components);
$formdata = new stdclass;
$formdata->categoryid = $row->id;
$newplugin = array('pluginname' => 'coursecategory', 'fullname' => 'coursecategory', 'formdata' => $formdata);
$components['conditions']['elements'][] = $newplugin;
$components['conditions']['config']->conditionexpr = $this->fix_condition_expr($components['conditions']['config']->conditionexpr, count($components['conditions']['elements']));
$reportclass->config->components = cr_serialize($components);
}
}
$reportclass->create_report();
$this->reportcache[$row->id] = $reportclass->finalreport->table->data;
}
if (!empty($this->reportcache[$row->id])) {
$subtable = array();
foreach ($this->reportcache[$row->id] as $r) {
$subtable[] = $r[$data->column];
}
return $subtable;
}
return '';
}
示例7: form_set_data
function form_set_data($cform)
{
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;
$components['permissions']['config']->conditionexpr = $fdata->conditionexpr;
$this->config->components = cr_serialize($components);
update_record('block_configurable_reports_report', $this->config);
$cform->set_data($fdata);
}
}
示例8: 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);
}
}
示例9: cr_import_xml
function cr_import_xml($xml, $course)
{
global $CFG, $DB, $USER;
require_once $CFG->dirroot . '/lib/xmlize.php';
$data = xmlize($xml, 1, 'UTF-8');
if (isset($data['report']['@']['version'])) {
$newreport = new stdclass();
foreach ($data['report']['#'] as $key => $val) {
if ($key == 'components') {
$val[0]['#'] = base64_decode(trim($val[0]['#']));
// fix url_encode " and ' when importing SQL queries
$temp_components = cr_unserialize($val[0]['#']);
$temp_components['customsql']['config']->querysql = str_replace("\\'", "'", $temp_components['customsql']['config']->querysql);
$temp_components['customsql']['config']->querysql = str_replace('\\"', '"', $temp_components['customsql']['config']->querysql);
$val[0]['#'] = cr_serialize($temp_components);
}
$newreport->{$key} = trim($val[0]['#']);
}
$newreport->courseid = $course->id;
$newreport->ownerid = $USER->id;
$newreport->name .= " (" . userdate(time()) . ")";
if (!$DB->insert_record('block_configurable_reports', $newreport)) {
return false;
}
return true;
}
return false;
}
示例10: 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['conditions']['config']) ? $components['conditions']['config'] : new stdclass();
if (!isset($conditionsconfig->conditionexpr)) {
$conditionsconfig->conditionexpr = '';
$conditionsconfig->conditionexpr = '';
}
$conditionsconfig->conditionexpr = $this->add_missing_conditions($conditionsconfig->conditionexpr);
$fdata->conditionexpr = $conditionsconfig->conditionexpr;
$components['conditions']['config']->conditionexpr = $fdata->conditionexpr;
$this->config->components = cr_serialize($components);
$DB->update_record('report_configreports', $this->config);
$cform->set_data($fdata);
}
}