Pages

Sunday, October 31, 2010

Firebug

Tool menarik buat web development. Bisa didapat dari http://getfirebug.com/downloads . Tool ini buat editing CSS dan sebagainya terkait dengan perwajahan dan kemudahan dalam editing. Tool ini merupakan add-on buat Mozilla, sebaiknya pakai Mozilla 3.6.x keatas

 

Okehhh review menyusul

Tuesday, October 12, 2010

Filter sesuai userid – Fabrik cuyy

Untuk memfilter data sesuai userid , bisa dipakai

 WHERE userid = '{$my->id}'

Mencari data sesuai current user – Fabrik coyy

How can I ensure users only see records created by themselves?


In your form add a "username" element, called "username" This element automatically inserts the current user's userid into your form as a hidden field.
Now each time you users adds a record, via the form, to the database table, their user id is also recorded.
The second thing to do is to edit your table, and add a prefilter so that each user sees only the records that they have created:

  • Edit your form's table.
  • Select the "data" tab
  • Under the "prefilter" section press "add filter"
  • Select "username" from the field dropdown (the "username" element we previously created)
  • Select "EQUALS" from the condition drop down list
  • Enter "{$my->id}" (without the quotes) into the "value" field
  • Select "super administrator" from the filter drop down. NOTE ! - this means that the filter is applied to everyone EXCEPT the super administrator. So in our case normal users will see only their records, where as the super administrator will see all the records
  • Save your table

Mengambil current user di Joomla

Untuk keperluan membuat web aplikasi di Joomla terkadang kita perlu mengambil data current user. Data user ini bisa diambil dengan menggunakan kode sbb :

$user =& JFactory::getUser();
$userId = $user->get( 'id' );
echo '<input type="hidden" name="user_id" value="' . $userId . '" />';