本文整理汇总了PHP中JoomdleHelperContent::get_course_url方法的典型用法代码示例。如果您正苦于以下问题:PHP JoomdleHelperContent::get_course_url方法的具体用法?PHP JoomdleHelperContent::get_course_url怎么用?PHP JoomdleHelperContent::get_course_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoomdleHelperContent
的用法示例。
在下文中一共展示了JoomdleHelperContent::get_course_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enrol
function enrol()
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$course_id = JRequest::getVar('course_id');
$course_id = (int) $course_id;
$login_url = JoomdleHelperMappings::get_login_url($course_id);
if (!$user->id) {
$mainframe->redirect($login_url);
}
$params = $mainframe->getParams();
/* Check that self enrolments are OK in course */
$enrol_methods = JoomdleHelperContent::call_method('course_enrol_methods', $course_id);
$self_ok = false;
foreach ($enrol_methods as $method) {
if ($method['enrol'] == 'self') {
$self_ok = true;
break;
}
}
if (!$self_ok) {
$url = JRoute::_("index.php?option=com_joomdle&view=detail&course_id={$course_id}");
$message = JText::_('COM_JOOMDLE_SELF_ENROLMENT_NOT_PERMITTED');
$this->setRedirect($url, $message);
return;
}
$user = JFactory::getUser();
$username = $user->get('username');
JoomdleHelperContent::enrolUser($username, $course_id);
// Redirect to course
$url = JoomdleHelperContent::get_course_url($course_id);
$mainframe->redirect($url);
}
示例2: actionbutton
static function actionbutton($course_info, $free_courses_button = 'enrol', $paid_courses_button = 'buy', $button_text = '')
{
$course_id = $course_info['remoteid'];
$user = JFactory::getUser();
$username = $user->username;
$is_enroled = $course_info['enroled'];
$guest = $course_info['guest'];
$params = JComponentHelper::getParams('com_joomdle');
$show_experience = $params->get('show_detail_application_experience');
$show_motivation = $params->get('show_detail_application_motivation');
$goto_course_button = $params->get('goto_course_button');
$linkstarget = $params->get('linkstarget');
$html = "";
if ($is_enroled || $guest) {
if ($goto_course_button) {
if (!$button_text) {
$button_text = JText::_('COM_JOOMDLE_GO_TO_COURSE');
}
$url = JoomdleHelperContent::get_course_url($course_id);
if ($linkstarget == 'new') {
$html .= '<FORM>
<INPUT TYPE="BUTTON" VALUE=" ' . $button_text . ' "
ONCLICK="window.open (\'' . $url . '\')">
</FORM>';
} else {
$html .= '<FORM>
<INPUT TYPE="BUTTON" VALUE=" ' . $button_text . ' "
ONCLICK="window.location.href=\' ' . $url . ' \'">
</FORM>';
}
}
} else {
if ((!array_key_exists('cost', $course_info) || !$course_info['cost']) && !JoomdleHelperShop::is_course_on_sell($course_id)) {
if ($free_courses_button == 'goto') {
if (!$button_text) {
$button_text = JText::_('COM_JOOMDLE_GO_TO_COURSE');
}
$url = JoomdleHelperContent::get_course_url($course_id);
if ($linkstarget == 'new') {
$html .= '<FORM>
<INPUT TYPE="BUTTON" VALUE=" ' . $button_text . ' "
ONCLICK="window.open (\'' . $url . '\')">
</FORM>';
} else {
$html .= '<FORM>
<INPUT TYPE="BUTTON" VALUE=" ' . $button_text . ' "
ONCLICK="window.location.href=\' ' . $url . ' \'">
</FORM>';
}
} else {
if ($free_courses_button == 'enrol') {
if (!$button_text) {
$button_text = JText::_('COM_JOOMDLE_ENROL_INTO_COURSE');
}
$url = "index.php?option=com_joomdle&task=enrol&course_id={$course_id}";
$can_enrol = $course_info['self_enrolment'] && $course_info['in_enrol_date'];
if ($can_enrol) {
$html .= '<FORM>
<INPUT TYPE="BUTTON" VALUE=" ' . $button_text . ' "
ONCLICK="window.location.href=\' ' . $url . ' \'">
</FORM>';
}
} else {
if ($free_courses_button == 'applicate') {
if (!$user->id) {
$html .= '<br>' . JText::_('COM_JOOMDLE_YOU_NEED_TO_LOGIN_TO_APPLICATE');
} else {
$app = JFactory::getApplication();
$results = $app->triggerEvent('onShowRequestCourseButton', array($course_id, $user->id, &$message));
if (in_array(false, $results)) {
$html .= $message;
} else {
$html .= '
<br>
<FORM action="index.php?option=com_joomdle" method="post"
id="josForm" name="josForm" class="form-validate">';
if ($show_motivation != 'no') {
$html .= JText::_('COM_JOOMDLE_MOTIVATION');
if ($show_motivation == 'mandatory') {
$html .= '*';
}
$html .= '<br>';
if ($show_motivation == 'mandatory') {
$html .= '<textarea id="motivation" class="inputbox required" name="motivation" cols="60" rows="4"></textarea><br>';
} else {
$html .= '<textarea id="motivation" name="motivation" cols="60" rows="4"></textarea><br>';
}
}
$html .= '<br> </br>';
if ($show_experience != 'no') {
$html .= JText::_('COM_JOOMDLE_EXPERIENCE');
if ($show_experience == 'mandatory') {
$html .= '*';
}
$html .= '<br>';
if ($show_experience == 'mandatory') {
$html .= '<textarea id="experience" class="inputbox required" name="experience" cols="60" rows="4"></textarea><br>';
} else {
$html .= '<textarea id="experience" name="experience" cols="60" rows="4"></textarea><br>';
}
//.........这里部分代码省略.........
示例3:
<input type="hidden" name="amount" value="<?php
echo $cost;
?>
" />
<input type="hidden" name="for_auction" value="false" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="notify_url" value="<?php
echo $this->moodle_url . '/enrol/paypal/ipn.php';
?>
" />
<?php
if ($this->params->get('linkstarget') == 'wrapper') {
$url = JoomdleHelperContent::get_course_url($course_id);
?>
<input type="hidden" name="return" value="<?php
echo $url;
?>
" />
<?php
} else {
?>
<input type="hidden" name="return" value="<?php
echo $this->moodle_url . '/enrol/paypal/return.php?id=' . $course_id;
?>
" />
<?php
}
?>