/**
  * Handles the ordering of models.
  */
 public function actionOrder()
 {
     if ($this->menu_use[1]) {
         // Handle the POST request data submission
         if (isset($_POST['Order'])) {
             // Since we converted the Javascript array to a string,
             // convert the string back to a PHP array
             $models = explode(',', $_POST['Order']);
             for ($i = 0; $i < sizeof($models); $i++) {
                 if ($model = Executive::model()->findbyPk($models[$i])) {
                     $model->sort_order = $i;
                     $model->save();
                 }
             }
         } else {
             $dataProvider = new CActiveDataProvider('Executive', array('pagination' => false, 'criteria' => array('order' => 'sort_order ASC, exec_id DESC')));
             $this->render('order', array('dataProvider' => $dataProvider));
         }
     } else {
         $this->redirect(array('site/index'));
     }
 }
 public function loadExecutiveModel($id)
 {
     $model = Executive::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }