Các bài đăng được tạo bởi Itamar Tzadok

If what you need is just a sort of calculator and you're not storing any user data, this should be fairly easy to do as a javascript widget which you can simply add to the page either in a label resource or a page block. cười

Afaict the only way to do that with the standard Database module is with a hack. In mod/data/view.php you can add a condition on $mode == 'single' and isguestuser() that redirects to the list view if true.

With the Dataform module you can set particular view access permission with a view access rule.

hth cười

Selecting text by the editor id does work. I guess you're running tests with firefox in which case you'd better switch to chrome. The selenium firefox webdriver seems to have serious issues finding elements with recent versions of firefox.

To run selenium with chrome you need to add to config.php something like:

$CFG->behat_config = array(
   'default' => array(
       'extensions' => array(
           'Behat\MinkExtension\Extension' => array(
               'selenium2' => array(
                   'browser' => 'chrome',
               )
           )
       )
   ),
   'chrome-win' => array(
       'filters' => array(
           'tags' => '~@_switch_window&&~@_file_upload'
       ),
   ),
);

You also need to download the chrome webdriver from https://code.google.com/p/selenium/wiki/ChromeDriver

Init behat for the new config to take effect.

And to run selenium:

java -jar path-to-your-selenium-jar/selenium-server-standalone.jar -Dwebdriver.chrome.driver=path-to-your-driver/chromedriver.exe

See https://docs.moodle.org/dev/Acceptance_testing/Browsers  for some more details.

As for verifying that the img is displayed, try something like:

And "//img[contains(@src, \'pluginfile.php\')]" "xpath_element" should exist in the ".some_css_class_of_a_container_element" "css_element"
And "//img[contains(@src, \'moodle_logo.jpg\')]" "xpath_element" should exist in the ".some_css_class_of_a_container_element" "css_element"

These steps verify that an img with src with pluginfile.php and the image name exists.

There may be a way to use regular expression for the contained value in which case one step could do the trick.

hth cười

Moodle in English -> Database -> Date Range Search? -> Re: Date Range Search?

Bởi Itamar Tzadok -

With the Database module you will have to fetch all entries and use javascript. And if you don't want to make this available to students you will have to add to the javascript proper conditions on the current user.

With the Dataform module you can create a filter with the desired search criterion on a time field or the entry's timecreated/timemodified property.

For a date range you can specify a criterion such as

BETWEEN  2014-09-01 .. 2014-10-01

or a relative criterion for current month

>=  first day of this month

etc.

Then if you don't want to make this filter available to students you can hide it. And you can also create for the teacher one of more views, different from the main list view, to use with designated filters to track progress or any other management task.

hth cười

There is probably no easy way to do that.

When you delete a user from Moodle the user record is not removed from DB but only modifed. If you just need to restore the user accounts you can ask your hosting service to run an SQL query on the mdl_user table to find the respective records and change the value in the 'deleted' column from 1 to 0. Then you will be able to see these user accounts under Administration > Accounts > Browse list of users, and proceed to change username and email address to the original.

Restoring data for these users is a whole different story. You may need to extract relevant data from a proper backup file and try to restore it. But this is going to be very difficult and very technical.

hth cười