Monday, May 18

Given string or char available in the word or not using PHP: strpos() method

Hi Guys,

The problem here is that strpos() returns the starting position index of $str2 in $str1 (if found), otherwise it returns false. So in this example, strpos() returns 0 (which is then obtain to false when referenced in the if statement). That’s why the code doesn’t work properly.

The correct solution would be to explicitly compare the value returned by strpos() to false as follows:

$str1 = 'gamechanger';
$str2 = 'change';
if(strpos($str1,$str2) !== false) {
    echo $str1 . " contains " . $str2 ;
} else {
    echo  $str1 . " does not contain " . $str2 ;
}


Without false condition it will execute the false statement ( else part).

Result

gamechanger contains changer

Tuesday, May 5

Course backup in Moodle

Hi Guys,


Course Backup.

1.    Go into the course.
2.    Click the Backup link either in the gear menu or the Administration block (Right corner).
3.    Initial settings - Select activities, blocks, filters and other items as required then click the Next button.
Uncheck the items for import and create new course. Else leave it as it is

Include enrolled users
Anonymize user information
Include user role assignments

Rest of things leave it as it is.
4.    Schema settings - Select/deselect specific items to include in backup, then click the Next button.
5.    If desired, select specific types of activity to be backed up by clicking the link 'Show type options'
6.    Confirmation and review - Check that everything is as required, using the Previous button if necessary, otherwise click the 'Perform backup' button.
7.    Complete - Click the Continue button.

Course Import in Moodle LMS

Hi Guys,


Course Import

   1.      Create new course.
  1. Inside the new course. click the Import link in the gear menu or the Administration block (Right corner).
  2. It will show the all the courses.
  3. Select the course you wish to import from and click Continue.
  4. You will be presented with the "backup settings" page. Use the check boxes for import activities, blocks and or filters as types of items which will show on the next screen.
  5. Select the elements you want to include in the import in the Schema settings step.
  6. Review and click Perform import or click the cancel or previous buttons. The confirmation page will place green check marks and red marks next to the backup settings and include item list for you to review.
8.      You should see the "Import complete. Click continue to return to the course." message, or an error message indicating that the import process did not take place.

Backup files to google drive using PHP coding

 Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...