本文整理汇总了PHP中EfrontLesson::export方法的典型用法代码示例。如果您正苦于以下问题:PHP EfrontLesson::export方法的具体用法?PHP EfrontLesson::export怎么用?PHP EfrontLesson::export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EfrontLesson
的用法示例。
在下文中一共展示了EfrontLesson::export方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serialize
$fields_insert['options'] = serialize($copyPropertiesLesson->options);
}
//Create the new lesson
$newLesson = EfrontLesson::createLesson($fields_insert);
//If a recurring payment is set, set this up to the lesson properties
if ($values['price'] && $values['recurring'] && in_array($values['recurring'], array_keys($recurringOptions))) {
$newLesson->options['recurring'] = $values['recurring'];
if ($newLesson->options['recurring']) {
$newLesson->options['recurring_duration'] = $form->exportValue($newLesson->options['recurring'] . '_duration');
}
$newLesson->persist();
}
//Import file, if any specified
if ($values['clone_lesson']) {
$cloneLesson = new EfrontLesson($values['clone_lesson']);
$file = $cloneLesson->export();
$exportedFile = $file->copy($newLesson->getDirectory() . '/' . $exportedFile['name']);
}
if (isset($exportedFile)) {
$newLesson->import($exportedFile);
} else {
//There was no file imported, then it's safe to add a default completion condition
$fields = array('lessons_ID' => $newLesson->lesson['id'], 'type' => 'all_units', 'relation' => 'and');
eF_insertTableData('lesson_conditions', $fields);
}
if ($newLesson->lesson['course_only']) {
//For course-only lessons, redirect to lessons list, not to "edit lesson" page
eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=lessons&message=" . urlencode(_SUCCESSFULLYCREATEDLESSON) . "&message_type=success");
} else {
eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=lessons&edit_lesson=" . $newLesson->lesson['id'] . "&tab=users&message=" . urlencode(_SUCCESSFULLYCREATEDLESSON) . "&message_type=success");
}
示例2: createInstance
/**
* Create lesson instance
*
* This function is used to create a lesson instance.
* <br/>Example:
* <code>
* $instance = EfrontLesson :: createInstance(43);
* </code>
*
* @param mixed $instanceSource Either a lesson id or an EfrontLesson object.
* @return EfrontLesson The new lesson instance
* @since 3.6.1
* @access public
* @static
*/
public static function createInstance($instanceSource, $originateCourse)
{
if (!$instanceSource instanceof EfrontLesson) {
$instanceSource = new EfrontLesson($instanceSource);
}
if (!$originateCourse instanceof EfrontCourse) {
$originateCourse = new EfrontCourse($originateCourse);
}
$result = eF_getTableData("lessons", "*", "id=" . $instanceSource->lesson['id']);
unset($result[0]['id']);
//unset($result[0]['directions_ID']); //Instances don't belong to a category
if (!$result[0]['share_folder']) {
$result[0]['share_folder'] = $instanceSource->lesson['id'];
}
//$result[0]['name'] .= ' ('._INSTANCE.')';
$result[0]['originating_course'] = $originateCourse->course['id'];
$result[0]['instance_source'] = $instanceSource->lesson['id'];
$file = $instanceSource->export(false, true, false);
$instance = EfrontLesson::createLesson($result[0]);
$instance->import($file, true, true, true);
$instance->course['originating_course'] = $originateCourse->course['id'];
$instance->course['instance_source'] = $instanceSource->lesson['id'];
$instance->persist();
$modules = eF_loadAllModules();
foreach ($modules as $module) {
$module->onCreateInstance($instance->lesson['id'], $instanceSource->lesson['id']);
}
return $instance;
}