/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = ContactGroups::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
} ?> <tr> <td> <?php echo Contacts::model()->getAttributeLabel('group'); ?> </td> <td> <?php $criteria = new CDbCriteria(); $criteria->condition = '`status`=:status'; $criteria->params = array(":status" => 1); $criteria->order = '`id` ASC'; $data = CHtml::listData(ContactGroups::model()->findAll($criteria), 'id', 'group_name'); echo CHtml::dropDownList('groups[]', '', $data, array('multiple' => true, 'style' => 'height:100px;')); ?> </td> </tr> </table> <div class="clear"></div> <input type="button" name="" value="Save contacts" id="save_contacts_btn" class="formbut" /> </form> <div id="results"></div> <script> $('#save_contacts_btn').click(function(e) { $.ajax({ url:'<?php echo Yii::app()->createUrl('/mailbox/contacts/save'); ?>
<?php $groups = ContactGroups::model()->findAll(); ?> <div class="clear"></div> <div class="content-box sent_table" id="groups-box"> <form id="select-group-form"> <table> <tr> <td> <?php foreach ($groups as $key => $group) { ?> <div class="popup_contact"> <ul> <li><input type="checkbox" value="<?php echo $group->id; ?> " name="group[]" id="group-<?php echo $group->id; ?> " class="select_group" /></li> <li><label for="group-<?php echo $group->id; ?> "><?php echo $group->group_name; ?> </label></li> </ul> </div>
<?php $criteria = new CDbCriteria(); $criteria->order = '`group_name` ASC'; //for pagination $total = ContactGroups::model()->count($criteria); $item_count = $total; $page_size = 30; $pages = new CPagination($total); $pages->setPageSize($page_size); $pages->applyLimit($criteria); // the trick is here! $groups = ContactGroups::model()->findAll($criteria); ?> <div class="clear"></div> <div class="content-box sent_table" id="groups-box"> <div class="sent_table_image_left"></div> <form id="select-group-form"> <table> <tr> <td> <div id="groups_pager"> <?php //pagination $this->widget('CLinkPager', array('currentPage' => $pages->getCurrentPage(), 'itemCount' => $item_count, 'pageSize' => $page_size, 'maxButtonCount' => 5, 'header' => '', 'htmlOptions' => array('class' => 'pages'))); ?> </div> <div class="popup_contact" style="width:500px;"> <?php if (count($groups) > 0) {