예제 #1
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->assignRef('params', $params);
     $this->my_courses = JoomdleHelperParents::getUnassignedCourses();
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     parent::display($tpl);
 }
예제 #2
0
 static function add_order_enrols_vm2($order_id, $user_id)
 {
     $db = JFactory::getDBO();
     $user = JFactory::getUser($user_id);
     $username = $user->username;
     $email = $user->email;
     /* Update user profile in Moodle  with VM data, if necessary */
     JoomdleHelperContent::call_method('create_joomdle_user', $username);
     $order_id = $db->Quote($order_id);
     $query = 'SELECT *' . ' FROM #__virtuemart_order_items' . ' WHERE virtuemart_order_id =';
     $query .= "{$order_id}";
     $db->setQuery($query);
     $items = $db->loadObjectList();
     if ($db->getErrorNum()) {
         JError::raiseWarning(500, $db->stderr());
     }
     /* No items in this order */
     if (count($items) == 0) {
         return;
     }
     $params = JComponentHelper::getParams('com_joomdle');
     $buy_for_children = $params->get('buy_for_children');
     $courses_category = $params->get('courses_category');
     foreach ($items as $item) {
         /* Only process product in Courses category */
         $product_id = $item->virtuemart_product_id;
         $order_item_id = $item->virtuemart_order_item_id;
         $query = "SELECT virtuemart_category_id" . " FROM #__virtuemart_product_categories" . " WHERE virtuemart_product_id=" . $db->Quote($product_id);
         $db->setQuery($query);
         $cats = $db->loadAssocList();
         $cats_array = array();
         foreach ($cats as $cat) {
             $cats_array[] = $cat['virtuemart_category_id'];
         }
         if ($db->getErrorNum()) {
             JError::raiseWarning(500, $db->stderr());
         }
         /* If it is a course */
         if (in_array($courses_category, $cats_array)) {
             $sku = $item->order_item_sku;
             if ($buy_for_children) {
                 if (strncmp($item->order_item_sku, 'bundle_', 7) == 0) {
                     //bundle
                     JoomdleHelperParents::purchase_bundle($username, $sku, $item->product_quantity);
                 } else {
                     JoomdleHelperParents::purchase_course($username, $sku, $item->product_quantity);
                 }
             } else {
                 if (strncmp($item->order_item_sku, 'bundle_', 7) == 0) {
                     //bundle
                     JoomdleHelperShop::enrol_bundle($username, $sku);
                 } else {
                     //course
                     JoomdleHelperContent::enrolUser($username, $sku);
                     /* Send confirmation email */
                     JoomdleHelperShop::send_confirmation_email($email, $sku);
                 }
             }
         }
     }
 }
예제 #3
0
        $odd = $odd % 2;
        ?>
        <td align="left">
                <?php 
        echo $curso['name'];
        ?>

        </td>
	<td>
                <?php 
        echo $curso['num'];
        ?>
	</td>
	<td>
	<?php 
        $options = JoomdleHelperParents::childrenCheckboxes($curso['id']);
        //	echo JHTML::_('select.genericlist', $options, 'children'.'['.$i.']', 'multiple=multiple', 'value', 'text', $value, $control_name.$name );
        ?>
	</td>
</tr>
<?php 
    }
    ?>
<tr>
<td>
<input type="submit" id="assign_courses" name="assign_courses" value="<?php 
    echo JText::_('COM_JOOMDLE_ASSIGN_COURSES');
    ?>
" />
</td>
</tr>
예제 #4
0
 function assigncourses()
 {
     $children = JRequest::getVar('children');
     if (!JoomdleHelperParents::check_assign_availability($children)) {
         $message = JText::_('COM_JOOMDLE_NOT_ENOUGH_COURSES');
         $this->setRedirect('index.php?option=com_joomdle&view=assigncourses', $message);
         //XXX poenr un get current uri
     } else {
         JoomdleHelperParents::assign_courses($children);
         $message = JText::_('COM_JOOMDLE_COURSES_ASSIGNED');
         $this->setRedirect('index.php?option=com_joomdle&view=assigncourses', $message);
         //XXX poenr un get current uri
     }
 }
예제 #5
0
 static function assign_course($course_id, $assingment)
 {
     foreach ($assingment as $user_id) {
         $user = JFactory::getUser($user_id);
         $username = $user->get('username');
         JoomdleHelperContent::enrolUser($username, $course_id);
         /* Send confirmation email */
         JoomdleHelperShop::send_confirmation_email($user->email, $course_id);
     }
     JoomdleHelperParents::update_purchase($course_id, $assingment);
 }
예제 #6
0
 function sync_parents_from_moodle()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     $cid = JRequest::getVar('cid', array(), 'post', 'array');
     JArrayHelper::toInteger($cid);
     if (count($cid) < 1) {
         JError::raiseError(500, JText::_('Select an item to unpublish'));
     }
     JoomdleHelperParents::sync_parents_from_moodle($cid);
     $this->setRedirect('index.php?option=com_joomdle&view=users');
 }