Modules Development

Discussion about eFront modules. You may suggest new modules here or post issues with current ones. This forum also offers suggestions and best practices for module developers.

Re: Modules Development

Postby buggy » Fri Mar 23, 2012 10:13 am

Hi!

How i can add a pagination in a module?

Thanks
Regards!
BuggY
buggy
 
Posts: 38
Joined: Tue Mar 13, 2012 1:16 pm
Location: Melilla, Spain

Re: Modules Development

Postby makriria » Mon Dec 03, 2012 3:05 pm

You can download demo module from this page and check its code to have the example you want.
Michael Makrigiannakis
Software Engineer
makriria@efrontlearning.net
skype: makriria
User avatar
makriria
 
Posts: 939
Joined: Thu Oct 04, 2007 12:16 pm

Re: Modules Development

Postby Setvir » Fri May 03, 2013 8:56 am

I have been searching for an answer to this riddle: Why does my module not show up on the student toolbar?

here is my code:
Code: Select all
<?php

//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}

/*
 * Class defining the new module
 * The name must match the one provided in the module.xml file
 */
class module_StartHere extends EfrontModule {

   /**
    * Get the module name, for example "Demo module"
    *
    * @see libraries/EfrontModule#getName()
    */
    public function getName() {
       //This is a language tag, defined in the file lang-<your language>.php
        return "Start Here";
    }

   /**
    * Return the array of roles that will have access to this module
    * You can return any combination of 'administrator', 'student' or 'professor'
    *
    * @see libraries/EfrontModule#getPermittedRoles()
    */
    public function getPermittedRoles() {
        return array("student","administrator");      //This module will be available to administrators
    }

    /**
    * (non-PHPdoc)
    * @see libraries/EfrontModule#getCenterLinkInfo()
     */
    public function getCenterLinkInfo() {
       $currentUser = $this -> getCurrentUser();
       if ($currentUser->getType() == "administrator") {
          return array('title' => $this -> getName(),
                     'image' => $this -> moduleBaseLink . 'img/icon.png',
                     'link'  => $this -> moduleBaseUrl);
      }
    }

   public function getSidebarLinkInfo () {
      $currentUser = $this -> getCurrentUser();
       if ($currentUser->getType() == "student") {
       return array('tools' => array ('title' => $this -> getName(),
                     'image' => $this -> moduleBaseLink . 'img/icon.png',
                     'link'  => $this -> moduleBaseUrl));
      }
   }
   /* *
     * The main functionality
     *
    * (non-PHPdoc)
    * @see libraries/EfrontModule#getModule()
     */
    public function getModule() {
        return '<p><span style="color: #1f497d;"><img src="'.$this -> moduleBaseLink.'img/logo.png" border="0" height="197" width="107" /></span><span style="color: #1f497d;"><br /></span></p>
<p><span style="color: #1f497d;">Step 1: Welcome to our Training Platform. You would have received an email with your registration details as well as a link to our e-training platform again. <br /></span></p>
<p><span style="color: #1f497d;">Step 2: Click on Course Catalog.</span></p>
<p><span style="color: #1f497d;">Step 3: Click on a  course for more information. </span></p>
<p><span style="color: #1f497d;">Step 4: If you decide that you want to enrol, click on the yellow bucket with the green + sign.</span></p>
<p><span style="color: #1f497d;">Step 5: You will see on the top right hand side the lesson added under the Selection Lesson.</span></p>
<p><span style="color: #1f497d;">Step 6: Click Continue.</span></p>
<p><span style="color: #1f497d;">Step 7: Click on Free Registration. </span></p>
<p><span style="color: #1f497d;">Step 8: Well done you have enrolled on your first course.</span></p>
<p><span style="color: #1f497d;">Step 9: Click on the course to start it.</span></p>';
    } 
    public function getNavigationLinks() {
        return array (array ('title' => _HOME, 'link'  => $_SERVER['PHP_SELF']),
                      array ('title' => $this -> getName(), 'link'  => $this -> moduleBaseUrl));
    }
}


It does show up in the administrator panel, but not on the tools panel in the student.

Can anyone please tell me what I should do to get it to work please!

Thanks for assisting.
Lionel
Setvir
 
Posts: 13
Joined: Tue Nov 06, 2012 11:22 am

Re: Modules Development

Postby y.sulistya » Fri May 03, 2013 10:49 am

Code: Select all
  public function getSidebarLinkInfo () {
      $currentUser = $this -> getCurrentUser();
       if ($currentUser->getType() == "student") {
       return array('tools' => array ('title' => $this -> getName(),
                     'image' => $this -> moduleBaseLink . 'img/icon.png',
                     'link'  => $this -> moduleBaseUrl));
      }
   }


This code will showing a module to the sidebar theme. What theme do you set for your eFront?
Blessings & Peace,
Yudi Sulistya

---
Database administrator & programmer at Faculty of Psychology • Airlangga University
Programmer at Cyber Campus • Airlangga University
Need personal help? contact me : yudi.sulistya[at]gmail.com
User avatar
y.sulistya
 
Posts: 717
Joined: Mon Apr 13, 2009 12:02 pm
Location: Surabaya, Indonesia

Previous

Return to Modules

Who is online

Users browsing this forum: No registered users and 1 guest

cron