Inheritance: extends DataObject
 /**
  * @return array customized attribute labels (name=>label)
  */
 public static function addLog($logType, $tablename, $desc)
 {
     $newMod = new ChangeLog();
     $newMod->tableName = $tablename;
     $newMod->desc = $desc;
     $newMod->logType = $logType;
     $newMod->save();
 }
 /**
  * Executes any command triggered on the admin page.
  */
 protected function processAdminCommand()
 {
     if (isset($_POST['command'], $_POST['id']) && $_POST['command'] === 'delete') {
         $trans = Trans::model()->findbyPk($_POST['id']);
         ChangeLog::addLog('DELETE', 'Trans', $trans->toString());
         $trans->delete();
         // reload the current page to avoid duplicated delete actions
         $this->refresh();
     }
 }
 /**
  * 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.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = ChangeLog::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
 /**
  * Executes any command triggered on the admin page.
  */
 protected function processAdminCommand()
 {
     if (isset($_POST['command'], $_POST['id']) && $_POST['command'] === 'delete') {
         $deleteUser = $this->loadUser($_POST['id']);
         ChangeLog::addLog('DELETE', 'User', $deleteUser->toString());
         $deleteUser->delete();
         // reload the current page to avoid duplicated delete actions
         $this->refresh();
     }
 }
Example #5
0
            $words = explode(' ', $msg);
            $num = count($words);
            while (1) {
                $line = implode(' ', array_slice($words, 0, $num));
                if (strlen($line) > 60) {
                    $num--;
                } else {
                    array_push($lines, $line);
                    $words = array_slice($words, $num);
                    $num = count($words);
                    if (!count($words)) {
                        break;
                    }
                }
            }
            $first = $indent;
            if (!$keepIndent) {
                $other = substr($indent, 0, strlen($indent) - 1);
            } else {
                $other = $indent;
            }
            $id = $first;
            foreach ($lines as $line) {
                echo $id . $line;
                $id = $other;
            }
        }
    }
}
$cl = new ChangeLog();
$cl->dumpChangeLog();
 /**
  * Executes any command triggered on the admin page.
  */
 protected function processAdminCommand()
 {
     if (isset($_POST['command'], $_POST['id']) && $_POST['command'] === 'delete') {
         $deletePeriod = $this->loadPeriod($_POST['id']);
         if (Yii::app()->user->getState('allowReEditingOfTransactions') || Trans::model()->find('periodId=' . $_POST['id']) == null) {
             ChangeLog::addLog('DELETE', 'Period', $deletePeriod->toString());
             $deletePeriod->delete();
             $usersModel = User::model()->findbyPk(Yii::app()->user->id);
             $usersModel->setStates(true);
         }
         // reload the current page to avoid duplicated delete actions
         $this->refresh();
     }
 }
 /**
  * Executes any command triggered on the admin page.
  */
 protected function processAdminCommand()
 {
     if (isset($_POST['command'], $_POST['id']) && $_POST['command'] === 'delete') {
         $deletecompany = $this->loadCompany($_POST['id']);
         ChangeLog::addLog('DELETE', 'Company', $deletecompany->toString());
         $deletecompany->delete();
         $usersModel = User::model()->findbyPk(Yii::app()->user->id);
         $usersModel->setStates(true);
         // reload the current page to avoid duplicated delete actions
         $this->refresh();
     }
 }