- Posts: 14
Tips & Tricks
Please do NOT use this section of the forum to request help if Joomdle does not work for you in some particular way. Your post will be deleted.
Please do NOT use this section of the forum to request help if Joomdle does not work for you in some particular way. Your post will be deleted.
How to call joomdle web service functions in my own service
- Alex
- Topic Author
- Offline
- New Member
-
Less
More
12 years 3 months ago #11
by Alex
Replied by Alex on topic How to call joomdle web service functions in my own service
hi antonio, iv'e seen the code and if i specify 'name' it create the query with "order by firstname lastnale"... However i've also tryed passing 'firstname' and doesn't work... this is the code of mentioned method in "moodle/auth/joomdle/auth.php"
function get_moodle_users ($limitstart, $limit, $order, $order_dir, $search )
{
global $CFG, $DB;
/* Don't show admins and guests */
$admins = get_admins();
foreach ($admins as $admin)
{
$a[] = $admin->id;
}
$a[] = 1; //Guest user
$userlist = "'".implode("','", $a)."'";
if ($limit)
$limit_c = " LIMIT $limitstart, $limit";
// kludge for ordering by name
if ($order == 'name')
$order = 'firstname, lastname';
if ($order != "")
$order_c = " ORDER BY $order $order_dir";
else $order_c = "";
if ($search)
$users = $DB->get_records_sql("SELECT id, username, email, firstname, lastname ,auth
FROM {$CFG->prefix}user
WHERE deleted = 0
AND((username like '%$search%') OR (email like '%$search%') OR (firstname like '%$search%') OR (lastname like '%$search%'))
$order_c
$limit_c");
else
$users = $DB->get_records_sql("SELECT id, username, email, firstname, lastname ,auth
FROM {$CFG->prefix}user
WHERE deleted = 0
$order_c
$limit_c");
$i = 0;
foreach ($users as $user)
{
$u[$i] = get_object_vars ($user);
if (in_array ($user->id, $a))
$u[$i] = '1';
else $u[$i] = '0';
$u[$i] = $user->firstname . ' ' . $user->lastname;
$i++;
}
return $u;
}
function get_moodle_users ($limitstart, $limit, $order, $order_dir, $search )
{
global $CFG, $DB;
/* Don't show admins and guests */
$admins = get_admins();
foreach ($admins as $admin)
{
$a[] = $admin->id;
}
$a[] = 1; //Guest user
$userlist = "'".implode("','", $a)."'";
if ($limit)
$limit_c = " LIMIT $limitstart, $limit";
// kludge for ordering by name
if ($order == 'name')
$order = 'firstname, lastname';
if ($order != "")
$order_c = " ORDER BY $order $order_dir";
else $order_c = "";
if ($search)
$users = $DB->get_records_sql("SELECT id, username, email, firstname, lastname ,auth
FROM {$CFG->prefix}user
WHERE deleted = 0
AND((username like '%$search%') OR (email like '%$search%') OR (firstname like '%$search%') OR (lastname like '%$search%'))
$order_c
$limit_c");
else
$users = $DB->get_records_sql("SELECT id, username, email, firstname, lastname ,auth
FROM {$CFG->prefix}user
WHERE deleted = 0
$order_c
$limit_c");
$i = 0;
foreach ($users as $user)
{
$u[$i] = get_object_vars ($user);
if (in_array ($user->id, $a))
$u[$i] = '1';
else $u[$i] = '0';
$u[$i] = $user->firstname . ' ' . $user->lastname;
$i++;
}
return $u;
}
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
12 years 3 months ago #12
by Antonio Durán
Replied by Antonio Durán on topic How to call joomdle web service functions in my own service
You are right, I had forgot about that.
I don't know why it is not working...it is not liking some of your params, but I don't know why
I don't know why it is not working...it is not liking some of your params, but I don't know why
Please Log in or Create an account to join the conversation.
- Alex
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 14
12 years 2 months ago #13
by Alex
Replied by Alex on topic How to call joomdle web service functions in my own service
i don't know how now it works!... usign
$request = xmlrpc_encode_request("joomdle_get_moodle_users", array(0, 20, '', '', $search), array ('encoding' => 'utf8'));
thanks for your support!
$request = xmlrpc_encode_request("joomdle_get_moodle_users", array(0, 20, '', '', $search), array ('encoding' => 'utf8'));
thanks for your support!
Please Log in or Create an account to join the conversation.