Tuesday, March 1, 2011

Yii Data Picker

DATA picker

the idea is the same as datePicker but its generating data from database rather than date.

to get this DataPicker working in the form you'll need CJuiDialog and CGridView.

maybe the picture below will helps you to understand the idea a little bit.




First of all you'll need to use CJuiDialog in your form and see how it works
and then added CGridView in your form.

open _form.php and modified a field a little bit.

labelEx($model,'id_pendaftar'); ?> hiddenField($model,'id_pendaftar'); ?> < input type="text" name="nama_pendaftar" id="nama_pendaftar" readonly value="findByPk($model->id_pendaftar)->nama_pemohon ?>"> 'del_pendaftar', 'id' => 'del_pendaftar', 'onclick' => '$("#nama_pendaftar").val("");$("#Izin_id_pendaftar").val("")')) ?> beginWidget('zii.widgets.jui.CJuiDialog', array( 'id'=>'pendaftar_dialog', // additional javascript options for the dialog plugin 'options'=>array( 'title'=>'List Pendaftar', 'width'=>'auto', 'autoOpen'=>false, ), )); /* Youll put CGridView Here */ $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'pendaftaran-grid', 'dataProvider'=>$pendaftaran_model->search(), 'filter'=>$pendaftaran_model, 'columns'=>array( 'no_daftar', array( 'header'=>'Tanggal Pendaftaran', 'name'=>'tgl_daftar', ), 'nama_pemohon', 'alamat_pemohon', 'nama_perusahaan', array( 'header'=>'', 'type'=>'raw', /* Here is The Button that will send the Data to The MAIN FORM */ 'value'=>'CHtml::Button("+", array("name" => "send_pendaftar", "id" => "send_pendaftar", "onClick" => "$(\"#pendaftar_dialog\").dialog(\"close\"); $(\"#nama_pendaftar\").val(\"$data->nama_pemohon\"); $(\"#Izin_id_pendaftar\").val(\"$data->id\");"))', ), ), )); $this->endWidget('zii.widgets.jui.CJuiDialog'); echo CHtml::Button('Get Pendaftar', array('onclick'=>'$("#pendaftar_dialog").dialog("open"); return false;', )) error($model,'id_pendaftar'); ?>

Youll Need to Modified the method in the Controller that is actionCreate and actionUpdate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
 {
            /* Data That will be loaded into CGridView */
            /* actually this was just a simple COPY PASTE from actionAdmin controller */
            /* DONT FORGET TO copy paste this into actionUpdate controller */
               $pendaftaran_model=new Pendaftaran('search');
  $pendaftaran_model->unsetAttributes();  // clear any default values
   if(isset($_GET['Pendaftaran']))
   $pendaftaran_model->attributes=$_GET['Pendaftaran']; 
           
           /* this Code is Default Code to Create Data you don't have to change this */
  $model=new Izin;
  
  
  if(isset($_POST['Izin']))
  {
   $model->attributes=$_POST['Izin'];
   if($model->save())
    $this->redirect(array('view','id'=>$model->id));
    
  }

  $this->render('create',array(
   'model'=>$model,
              /* DONT FORGET TO RENDER THE DATA PROVIDER INTO VARIABLE THAT WILL BE LOADED INTO CGRIDVIEW */
   'pendaftaran_model'=>$pendaftaran_model,
  
  ));
 }

After this you have to Modified a little bit in the create.php and update.php.

create.php and update.php is located at View folder

renderPartial('_form',
                         array('model'=>$model,
                              /* DONT FORGET TO DO THIS OR NO DATA PROVIDER WILL BE LOADED */
                              'pendaftaran_model'=>$pendaftaran_model
                               )); 
?>

Done now you'll have a Data Picker.
im sorry for the messy code and my bad english.

Tuesday, September 21, 2010

Free DropDownMenu

There are few site that host free dropdownmenu...
this is the only site that i found interesting

http://www.lwis.net/free-css-drop-down-menu/
and
dynamicdrive.com

Friday, August 20, 2010

Drupal : Creating SlideShow

Currently i have been digging this slideshow for drupal. but i still can't get the hang of it.

i really wanna write something about this. but frankly, i can't... for now..

if i found how to create a slideshow on the homepage of drupal website. i'll let you all now.

im trying to figure out the ddblock from drupal. here's the module https://drupal.org/project/ddblock

just a little note.
since i am having problem with the image not showing.
i should check for Administer->Site Configuration->File System
if it said sites/default/files
and @Image Folder setting in Home » Administer » Site building » Blocks said
sites/default/files
it just mean that you should place the image @sites/default/files/sites/default/files/images.jpg
it really took quite a while to figuring this.

another note is : at administer page the image and block is showing but at anonymous user is not showing at all.
Check Permission @Home » Administer » User management
@ddk block module check list the anonymous user.

Saturday, July 31, 2010

TUTORIAL DRUPAL : CREATING HOMEPAGE [part 4]

If this is your first visit then you should know that this is the part 4. You can read the previous part from this link :

TUTORIAL DRUPAL : CREATING HOMEPAGE [part 1]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 2]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 3]


Now for the part for of the tutorial. I will create the copyrights thingy at the bottom right of the page.

Lets just see what i’ve done in the analysis. This is what i will try to create.



After few tries this is actually very simple. The field that handle footer like this is located at “Site Information”.
Lets go to “Site Information” just click [Administer->Site configuration->Site Information]. Then just fill the “Footer Message Field”. you can write few HTML code in the field. just like this.



And Thats it. IT IS SIMPLE WHEN YOU KNOW WHERE THE FIELD IS. Actually its preety much spending a hours or two just to find the right field.

Thanks for reading this crap. I appreciate it. ?

please Visit The Previous Tutorial :

TUTORIAL DRUPAL : CREATING HOMEPAGE [part 1]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 2]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 3]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 4]

Wednesday, July 28, 2010

TUTORIAL DRUPAL : CREATING HOMEPAGE [part 3]

If this were you drop. then you'll notice this is the part 3. please visit my previous tutorial through this link :
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 1]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 2]

Now i’m gonna write about how we make “News and Event” that appear at homepage.
First off all lets see the analysis. Overall analysis is already made at the first part of this blog. You can access it from these link. Anyway here’s the analysis.



From the first analysis-i don’t know if that is called analysis- i still don’t know what “Content Type” or “Module” that being used.
After done with several test, and try it seems that “Blog Module” have some “Block” called “Recent Blog Post”. This block is displaying recent blog post without the dates. I think its preety much the same except maybe a little detail. So im gonna use this module. To create “News and Event”.

Activate the module to add blog functionallity to the web. Go to [Administer->Site Building->Modules]. Then Check “Blog” to enable them.



As you can see we now have “Blog Entry” Submenu at the “Create Content Menu”.



Lets just start creating Content. Go to [Create Content->Blog Entry].

Fill Title as the title of an article that youve made and Body for the article.

And the don’t forget to Uncheck “Promoted to Front Page” so the article won’t be shown at the homepage area. “Promoted to Front Page” located at “Publishing Options” Category.




Create a few article, two article maybe three. If you don’t know what to write just copy paste something from the web.

We’re done Creating Article. Next thing to do is to activate the “Recent blog post” blocks.
To activate the blocks go to [Administer-> Site Building -> Blocks].



As you can see now “Recent Blog Post” block is already appear at the Disabled Category.
Now lets decide where the right area for the “Recent Blog Post” to appear. I think right side bar is a good idea. Lets choose right side bar from region combobox. Then click save.



As you can see now a “Recent Blog Post” is actually show at right side bar. And now all we have to do is to change the title into “News and Event”.

Just go to blocks again click configure at "Recent Blog Post" and then change the title of the block into “News and Event”.

Thats it. Congratulation you’ve done creating Recent “News and Event” to the site without the date and without which site that updating the article.

Thanks for reading. I don’t know what to write for the next chapter. But i’ll figure it out somehow

this is the previous link :
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 1]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 2]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 3]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 4]

Tuesday, July 27, 2010

Learning Taxonomy in drupal

currently i'm learning taxonomy in drupal.
i don't quite get it.
i'll just keep on trying and just see what the result.
i hope i can create something simple.

Monday, July 26, 2010

TUTORIAL DRUPAL : CREATING HOMEPAGE [part 2]

For the previous tutorial i’ve done creating primary link. And if you still confuse about primary link. I suggest just go to http://drupal.org and search there.

If you already got here and doesn’t now anything i suggest you go to the first part of tutorial. Click these link to go to the first tutorial.

Lets just go straight to the point. I want to create secondary link that appear at the bottom of the page. That is the footer page. Lets start.

Now Lets Create the Secondary Link item [Administer->Site Building->Menus->Secondary Links->Add Item]



With the same configuration as the Primary links in the previous post. Use for the path and the name of the menu for the Menu Link Title Field.



Now youll see that everything is messed up. Dont panic its just The secondary links doesnt appear the way i want. Its supposed to be at the bottom or footer.



Its time to fix these. As you can see the secondary link at the header bar is not preety And its disturbing. That place can’t be change by managing BLOCK because its a default postition from the theme. So we have to change the way of the Theme.
To handle that we need to :
1. make the theme not to show secondary link
2. and use block to create secondary link to appear at footer page.

To fix and to tell the theme not to showing the secondary link at the header bar/ default area were going to reconfigure the theme.

Lets just go to [Site Building->Themes->Configure] and then go to [Garland(its the name of the theme)]





then uncheck the Secondary Link Checkbox at toggle display. Over here you can also upload the logo image. And icon image. But were going into that in some other time. Save configuration.



Now you can see that the secondary links is dissapear.

Done with the first task. Right now we want to make them reapear at the footer area.Lets go to BLOCKS to control where we want it to appear.




At the Disabled category in blocks page you'll see Secondary Link and change the combobox from to Footer.
Now the secondary link its already at the bottom of web site.




Congratulation you'll now already now a lil bit of creating web with drupal. Well the exact words is creating and modified the menu.

From here on maybe you don't have to read these tutorial again. Because drupal is already simple as it is.
If you wanna read it till the end of the tutorial. I appreciate that and Thank you very much For reading this piece of crap.
I’am very Sorry about grammar or anything that relate to english. Coz im just starting to create tutorial. And i know its bad.

This is the updated link :
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 1]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 2]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 3]
TUTORIAL DRUPAL : CREATING HOMEPAGE [part 4]