Example #1
0
 static function save_list($name, $description)
 {
     require_once JPATH_ADMINISTRATOR . '/' . 'components' . '/' . 'com_acymailing' . '/' . 'helpers' . '/' . 'helper.php';
     $db = JFactory::getDBO();
     $list = new JObject();
     $list->name = $name;
     $list->alias = JFilterOutput::stringURLSafe(trim($name));
     $list->description = $description;
     $list->published = 1;
     $list->visible = 1;
     $list->userid = JoomdleHelperSystem::get_admin_id();
     $list->color = '#ffcc66';
     $status = $db->insertObject(acymailing_table('list'), $list);
     $insert_id = $db->insertid();
     // Re-order
     $orderClass = acymailing_get('helper.order');
     $orderClass->pkey = 'listid';
     $orderClass->table = 'list';
     $orderClass->groupMap = 'type';
     $orderClass->groupVal = 'list';
     $orderClass->reOrder();
     return $insert_id;
 }
Example #2
0
echo $this->course_info['fullname'];
?>
        </td>
</tr>

<tr>
        <td width="60%" colspan="2">
        </td>
</tr>
<tr class="sectiontableentry">
	<td align="left">
                <b><?php 
echo JText::_('COM_JOOMDLE_SUMMARY');
?>
:&nbsp;</b><?php 
echo JoomdleHelperSystem::fix_text_format($this->course_info['summary']);
?>
        </td>
</tr>
<tr class="sectiontableentry">
	<td align="left">
                <b><?php 
echo JText::_('COM_JOOMDLE_STUDENT_NO');
?>
:&nbsp;</b><?php 
echo $this->student_no;
?>
        </td>
</tr>

Example #3
0
    <?php 
if (is_array($this->categories)) {
    foreach ($this->categories as $cat) {
        ?>
			<div class="joomdle_category_list_item">
				<div class="joomdle_item_title joomdle_category_list_item_title">
                <?php 
        $url = JRoute::_("index.php?option=com_joomdle&view=coursecategory&cat_id=" . $cat['id'] . ':' . JFilterOutput::stringURLSafe($cat['name']) . "&Itemid={$itemid}");
        ?>
                <?php 
        echo "<a href=\"{$url}\">" . $cat['name'] . "</a>";
        ?>
                </div>
                <?php 
        if ($cat['description']) {
            ?>
                <div class="joomdle_item_content joomdle_course_list_item_description">
                <?php 
            echo JoomdleHelperSystem::fix_text_format($cat['description']);
            ?>
                </div>
                <?php 
        }
        ?>
            </div>
<?php 
    }
}
?>
</div>
Example #4
0
foreach ($this->cursos as  $curso) : ?>
<?php
$cat_id = $curso['cat_id'];
$course_id = $curso['remoteid'];
$cat_slug = JFilterOutput::stringURLSafe ($curso['cat_name']);
$course_slug = JFilterOutput::stringURLSafe ($curso['fullname']);
?>
    <div class="joomdle_course_list_item">
        <div class="joomdle_item_title joomdle_course_list_item_title">
        <?php $url = JRoute::_("index.php?option=com_joomdle&view=detail&cat_id=$cat_id:$cat_slug&course_id=$course_id:$course_slug&Itemid=$itemid"); ?>
        <?php  echo "<a href=\"$url\">".$curso['fullname']."</a>"; ?>
        </div>
        <?php if ($curso['summary']) : ?>
        <div class="joomdle_item_content joomdle_course_list_item_description">
				<div class="joomdle_course_description">
                <?php echo JoomdleHelperSystem::fix_text_format($curso['summary']); ?>
				</div>
				 <?php if ($show_buttons) : ?>
				<div class="joomdle_course_buttons">
                <?php
                    echo JoomdleHelperSystem::actionbutton ( $curso, $free_courses_button, $paid_courses_button);
                ?>
				</div>
				<?php endif; ?>
        </div>
        <?php endif; ?>
	</div>
<?php endforeach;  ?>

</div>
Example #5
0
 if (!$mtype) {
     // skip unknow modules
     continue;
 }
 $icon_url = JoomdleHelperSystem::get_icon_url($resource['mod'], $resource['type']);
 if ($icon_url) {
     echo '<img align="center" src="' . $icon_url . '">&nbsp;';
 }
 if ($resource['mod'] == 'label') {
     echo '</P>';
     echo $resource['content'];
     echo '</P>';
     continue;
 }
 if ($this->is_enroled && $resource['available']) {
     $direct_link = JoomdleHelperSystem::get_direct_link($resource['mod'], $course_id, $resource['id'], $resource['type']);
     if ($direct_link) {
         // Open in new window if configured like that in moodle
         if ($resource['display'] == 6) {
             $resource_target = 'target="_blank"';
         } else {
             $resource_target = '';
         }
         if ($direct_link != 'none') {
             echo "<a {$resource_target}  href=\"" . $direct_link . "\">" . $resource['name'] . "</a><br>";
         }
     } else {
         echo "<a {$target} href=\"" . $jump_url . "&mtype={$mtype}&id=" . $resource['id'] . "&course_id={$course_id}&create_user=0&Itemid={$itemid}&redirect={$direct_link}\">" . $resource['name'] . "</a><br>";
     }
 } else {
     echo $resource['name'] . '<br>';
Example #6
0
		$cat_id = $course_info['cat_id'];
		$course_id = $course_info['remoteid'];
		$cat_slug = JFilterOutput::stringURLSafe ($course_info['cat_name']);
		$course_slug = JFilterOutput::stringURLSafe ($course_info['fullname']);

	if ($show_topics_link) : ?>
		<?php $url = JRoute::_("index.php?option=com_joomdle&view=topics&cat_id=$cat_id:$cat_slug&course_id=$course_id:$course_slug&Itemid=$itemid"); ?>
		<P><b><?php  echo "<a href=\"$url\">".JText::_('COM_JOOMDLE_COURSE_TOPICS')."</a><br>"; ?></b>
	<?php endif; ?>
	<?php
	if ($show_contents_link) : ?>
        <?php $url = JRoute::_("index.php?option=com_joomdle&view=course&cat_id=$cat_id:$cat_slug&course_id=$course_id:$course_slug&Itemid=$itemid"); ?>
        <P><b><?php  echo "<a href=\"$url\">".JText::_('COM_JOOMDLE_COURSE_CONTENTS')."</a><br>"; ?></b>
    <?php endif; ?>
	<?php
	if ($show_grading_system_link) : ?>
		<?php $url = JRoute::_("index.php?option=com_joomdle&view=coursegradecategories&cat_id=$cat_id:$cat_slug&course_id=$course_id:$course_slug&Itemid=$itemid"); ?>
		<P><b><?php  echo "<a href=\"$url\">".JText::_('COM_JOOMDLE_COURSE_GRADING_SYSTEM')."</a><br>"; ?></b>
	<?php endif; ?>
	<?php
	if ($show_teachers_link) : ?>
		<?php $url = JRoute::_("index.php?option=com_joomdle&view=teachers&cat_id=$cat_id:$cat_slug&course_id=$course_id:$course_slug&Itemid=$itemid"); ?>
		<P><b><?php  echo "<a href=\"$url\">".JText::_('COM_JOOMDLE_COURSE_TEACHERS')."</a><br>"; ?></b>
	<?php endif; ?>
	</div>

	<div class="joomdle_course_buttons">
		<?php echo JoomdleHelperSystem::actionbutton ( $course_info, $free_courses_button, $paid_courses_button) ?>
	</div>
</div>
Example #7
0
 static function add_activity_course_jomsocial($id, $name, $desc, $cat_id, $cat_name)
 {
     require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
     CFactory::load('libraries', 'activities');
     $cat_slug = JFilterOutput::stringURLSafe($cat_name);
     $course_slug = JFilterOutput::stringURLSafe($name);
     $mainframe = JFactory::getApplication('site');
     $mainframe->initialise();
     /* Kludge para que no pete el call_method */
     if ($desc == ' ') {
         $desc = '';
     }
     $user_id = JoomdleHelperSystem::get_admin_id();
     $act = new stdClass();
     $message = JText::_('COM_JOOMDLE_NEW_COURSE_AVAILABLE') . '';
     $link = "index.php?option=com_joomdle&view=detail&cat_id={$cat_id}:{$cat_slug}&course_id={$id}:{$course_slug}";
     $message .= ' <a href="' . $link . '">' . $name . '</a> ';
     $cat_link = "index.php?option=com_joomdle&view=coursecategory&cat_id={$cat_id}:{$cat_slug}";
     $message .= JText::_('COM_JOOMDLE_IN_CATEGORY') . " ";
     $message .= ' <a href="' . $cat_link . '">' . $cat_name . '</a> ';
     $act->cmd = 'joomdle.create';
     $act->actor = $user_id;
     $act->access = 0;
     $act->target = 0;
     $act->title = JText::_($message);
     $act->content = $desc;
     $act->app = 'joomdle';
     $act->cid = 0;
     CActivityStream::add($act);
     return "OK";
 }
Example #8
0
 function register_save()
 {
     $otherlanguage = JFactory::getLanguage();
     $otherlanguage->load('com_user', JPATH_SITE);
     $usersConfig = JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     $authorize = JFactory::getACL();
     $user = new JUser();
     $system = 2;
     // ID of Registered
     $user->groups = array();
     $user->groups[] = $system;
     // Bind the post array to the user object
     $post = JRequest::get('post');
     if (!$user->bind($post, 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $date = JFactory::getDate();
     $user->set('registerDate', $date->toSql());
     $parent = JFactory::getUser();
     $user->setParam('u' . $parent->id . '_parent_id', $parent->id);
     // If user activation is turned on, we need to set the activation information
     $useractivation = $usersConfig->get('useractivation');
     if ($useractivation == 1 || $useractivation == 2) {
         jimport('joomla.user.helper');
         $user->set('activation', JApplication::getHash(JUserHelper::genRandomPassword()));
         $user->set('block', '1');
     }
     // If there was an error with registration, set the message and display form
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         $this->setRedirect('index.php?option=com_joomdle&view=register');
         return false;
     }
     // Add to profile type if needed
     $params = JComponentHelper::getParams('com_joomdle');
     $children_pt = $params->get('children_profiletype');
     if ($children_pt) {
         JoomdleHelperProfiletypes::add_user_to_profile($user->id, $children_pt);
     }
     // Send registration confirmation mail
     $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     // UserController::_sendMail($user, $password);
     JoomdleHelperSystem::send_registration_email($user->username, $password);
     $parent_user = JFactory::getUser();
     // Set parent role in Moodle
     JoomdleHelperContent::call_method("add_parent_role", $user->username, $parent_user->username);
     $message = JText::_('COM_JOOMDLE_USER_CREATED');
     $this->setRedirect('index.php?option=com_joomdle&view=register', $message);
     //XXX poenr un get current uri
 }
Example #9
0
 static function addJSGroup($name, $description, $course_id, $website)
 {
     if (file_exists(JPATH_ADMINISTRATOR . '/components/com_community/tables/cache.php')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_community/tables/cache.php';
     }
     require_once JPATH_SITE . '/components/com_community/libraries/core.php';
     require_once JPATH_SITE . '/components/com_community/models/groups.php';
     $mainframe = JFactory::getApplication();
     // Get my current data.
     $validated = true;
     $group = JTable::getInstance('Group', 'CTable');
     $model = CFactory::getModel('groups');
     // @rule: Test for emptyness
     if (empty($name)) {
         $validated = false;
     }
     // @rule: Test if group exists
     if ($model->groupExist($name)) {
         $validated = false;
     }
     // @rule: Test for emptyness
     if (empty($description)) {
         $validated = false;
     }
     $categoryId = JoomdleHelperGroups::get_main_category();
     if (empty($categoryId)) {
         $validated = false;
     }
     if ($validated) {
         // Assertions
         // Category Id must not be empty and will cause failure on this group if its empty.
         CError::assert($categoryId, '', '!empty', __FILE__, __LINE__);
         // @rule: Retrieve params and store it back as raw string
         $params = new CParameter('');
         $discussordering = JRequest::getVar('discussordering', DISCUSSION_ORDER_BYLASTACTIVITY, 'REQUEST');
         $params->set('discussordering', $discussordering);
         $photopermission = JRequest::getVar('photopermission', GROUP_PHOTO_PERMISSION_ADMINS, 'REQUEST');
         $params->set('photopermission', $photopermission);
         $videopermission = JRequest::getVar('videopermission', GROUP_PHOTO_PERMISSION_ADMINS, 'REQUEST');
         $params->set('videopermission', $videopermission);
         $grouprecentphotos = JRequest::getVar('grouprecentphotos', GROUP_PHOTO_RECENT_LIMIT, 'REQUEST');
         $params->set('grouprecentphotos', $grouprecentphotos);
         $grouprecentvideos = JRequest::getVar('grouprecentvideos', GROUP_VIDEO_RECENT_LIMIT, 'REQUEST');
         $params->set('grouprecentvideos', $grouprecentvideos);
         $newmembernotification = JRequest::getVar('newmembernotification', '1', 'REQUEST');
         $params->set('newmembernotification', $newmembernotification);
         $joinrequestnotification = JRequest::getVar('joinrequestnotification', '1', 'REQUEST');
         $params->set('joinrequestnotification', $joinrequestnotification);
         $params->set('course_id', $course_id);
         CFactory::load('helpers', 'owner');
         $group->name = $name;
         $group->description = $description;
         $group->categoryid = $categoryId;
         $group->website = $website;
         $group->ownerid = JoomdleHelperSystem::get_admin_id();
         $group->created = gmdate('Y-m-d H:i:s');
         $group->approvals = 1;
         $group->params = $params->toString();
         // Set the default thumbnail and avatar for the group just in case
         // the user decides to skip this
         //   $group->thumb           = 'components/com_community/assets/group_thumb.jpg';
         //   $group->avatar          = 'components/com_community/assets/group.jpg';
         $group->published = 1;
         // Store the group now.
         $group->store();
         // Since this is storing groups, we also need to store the creator / admin
         // into the groups members table
         $member = JTable::getInstance('GroupMembers', 'CTable');
         $member->groupid = $group->id;
         $member->memberid = $group->ownerid;
         // Creator should always be 1 as approved as they are the creator.
         $member->approved = 1;
         // @todo: Setup required permissions in the future
         $member->permissions = '1';
         $member->store();
         // Increment the member count
         $group->updateStats();
         $group->store();
     }
     return "OK";
 }
Example #10
0
                 ?>
         <div class="joomdle_course_list_item">
             <div class="joomdle_item_title joomdle_course_list_item_title">
                     <?php 
                 $url = JRoute::_("index.php?option=com_joomdle&&view=detail&cat_id={$cat_id}:" . JFilterOutput::stringURLSafe($cat['name']) . "&course_id=" . $curso['remoteid'] . ":" . JFilterOutput::stringURLSafe($curso['fullname']) . "&Itemid={$itemid}");
                 ?>
                     <?php 
                 echo "<a href=\"{$url}\">" . $curso['fullname'] . "</a>";
                 ?>
             </div>
             <?php 
                 if ($curso['summary']) {
                     ?>
             <div class="joomdle_item_content joomdle_course_list_item_description">
                     <?php 
                     echo JoomdleHelperSystem::fix_text_format($curso['summary']);
                     ?>
             </div>
             <?php 
                 }
                 ?>
         </div>
         <?php 
             }
             //cursos
             ?>
     <?php 
         }
         //cats
         ?>
 <?php 
Example #11
0
<?php

/**
 * Joomdle
 *
 * @author Antonio Durán Terrés
 * @package Joomdle
 * @license GNU/GPL
 *
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
//JHTML::_('stylesheet', 'joomdle.css', 'administrator/components/com_joomdle/assets/css/');
/*
 * Define constants for all pages
 */
define('COM_JOOMDLE_DIR', 'images' . '/' . 'joomdle' . '/');
define('COM_JOOMDLE_BASE', JPATH_ROOT . '/' . COM_JOOMDLE_DIR);
define('COM_JOOMDLE_BASEURL', JURI::root() . str_replace('/', '/', COM_JOOMDLE_DIR));
// Require the base controller
require_once JPATH_COMPONENT . '/' . 'controller.php';
// Require the base controller
require_once JPATH_COMPONENT . '/' . 'helpers' . '/' . 'system.php';
JoomdleHelperSystem::check_system();
$controller = JControllerLegacy::getInstance('Joomdle');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();