.

DAOScheduler Class Reference

DAO Class for Scheduler. More...

Inheritance diagram for DAOScheduler:
DataObjectBase IStatusHolder ISelfDescribing IDataObject IActionSource ISearchAdapter IDBTable IDBWhereHolder

List of all members.

Public Member Functions

  get_description ()
  Get description for this instance.
  get_filters ()
  Return array of user status filters.
  get_sort_default_column ()
  Get the column to sort by default.
  get_sortable_columns ()
  Return array of sortable columns.
  get_status ()
  get status
  get_title ()
  Get title for this class.
  is_active ()
  check if status active
  is_deleted ()
  Check if status is deleted.
  is_disabled ()
  check if status is disabled
  is_unconfirmed ()
  Check if status is unconfirmed.
  set_status ($status)
  set status
  validate ()
  Validate this object.

Public Attributes

  $action
  $error_message
  $id
  $name
  $reschedule_error
  $reschedule_success
  $runs_error
  $runs_success
  $scheduledate
  $status

Protected Member Functions

  create_table_object ()
  Create table description.
  get_actions_for_context ($context, $user, $params)
  get actions for context

Detailed Description

DAO Class for Scheduler.

Definition at line 6 of file scheduler.model.php.


Member Function Documentation

DAOScheduler::create_table_object (  )  [protected]

Create table description.

Returns:
DBTable Object

Reimplemented from DataObjectBase.

Definition at line 23 of file scheduler.model.php.

00023                                                  {
00024                 return new DBTable(
00025                         'scheduler',
00026                         array(
00027                                 new DBFieldInt('id', null, DBFieldInt::AUTOINCREMENT | DBFieldInt::NOT_NULL | DBFieldInt::UNSIGNED),
00028                                 new DBFieldDateTime('scheduledate', DBFieldDateTime::NOW, DBFieldDateTime::NOT_NULL),
00029                                 new DBFieldEnum('reschedule_error', array_keys(Scheduler::get_reschedule_policies()), Scheduler::RESCHEDULE_TERMINATOR_1, DBFieldEnum::NOT_NULL),
00030                                 new DBFieldEnum('reschedule_success', array_keys(Scheduler::get_reschedule_policies()), Scheduler::RESCHEDULE_TERMINATOR_1, DBFieldEnum::NOT_NULL),
00031                                 new DBFieldInt('runs_error', 0, DBFieldInt::UNSIGNED | DBFieldInt::NOT_NULL),
00032                                 new DBFieldInt('runs_success', 0, DBFieldInt::UNSIGNED | DBFieldInt::NOT_NULL),
00033                                 new DBFieldText('action', 255, null, DBFieldText::NOT_NULL ),
00034                                 new DBFieldText('name', 255, null, DBFieldText::NOT_NULL ),
00035                                 new DBFieldText('error_message', DBFieldText::BLOB_LENGTH_SMALL, null, DBFieldText::NONE),
00036                                 new DBFieldEnum('status', array_keys(Scheduler::get_statuses()), Scheduler::STATUS_ACTIVE, DBFieldEnum::NOT_NULL )
00037                         ),
00038                         'id'
00039                 );
00040         }
DAOScheduler::get_actions_for_context ( context,
user,
params  
) [protected]

get actions for context

Parameters:
string  $context
DAOUser  $user
string  $params
Returns:
array of actions

Reimplemented from DataObjectBase.

Definition at line 141 of file scheduler.model.php.

00141                                                                             {
00142                 $ret = array();
00143                 if ($context == 'list') {
00144                         foreach(Scheduler::get_statuses() as $key => $descr) {
00145                                 if ($key === Scheduler::STATUS_ACTIVE || $key === Scheduler::STATUS_DISABLED) {
00146                                         $cmd = 'status['. $key .']';
00147                                         $descr = tr('Set'. $descr, 'scheduler');
00148                                         $ret[$cmd] = $descr;
00149                                 }
00150                         }
00151                 }
00152                 return $ret;
00153         }
DAOScheduler::get_description (  ) 

Get description for this instance.

Returns:
string

Implements ISelfDescribing.

Definition at line 125 of file scheduler.model.php.

00125                                           {
00126                 return '';
00127         }       
DAOScheduler::get_filters (  ) 

Return array of user status filters.

Array has filter as key and a readable description as value

Reimplemented from DataObjectBase.

Definition at line 158 of file scheduler.model.php.

00158                                       {
00159                 $arr_stat = array();
00160                 foreach(Scheduler::get_statuses() as $k => $d) {
00161                         $arr_stat[strtolower($k)] = new DBFilterColumn(
00162                                 'scheduler.status', $k, $d
00163                         ); 
00164                 }
00165                 return array(
00166                         new DBFilterGroup(
00167                                 'status',
00168                                 tr('Status'),
00169                                 $arr_stat
00170                         ),
00171                 );
00172         }
DAOScheduler::get_sort_default_column (  ) 

Get the column to sort by default.

Reimplemented from DataObjectBase.

Definition at line 186 of file scheduler.model.php.

00186                                                   {
00187                 return 'scheduledate';
00188         }
DAOScheduler::get_sortable_columns (  ) 

Return array of sortable columns.

Array has column name as key and some sort of sort-column-object or an array as values

Reimplemented from DataObjectBase.

Definition at line 177 of file scheduler.model.php.

00177                                                {
00178                 return array(
00179                         'scheduledate' => new DBSortColumn('scheduledate', tr('Execution time', 'scheduler'), DBSortColumn::TYPE_DATE, DBSortColumn::ORDER_FORWARD, true),
00180                 );
00181         }
DAOScheduler::get_status (  ) 

get status

Implements IStatusHolder.

Definition at line 68 of file scheduler.model.php.

00068                                      {
00069                 return $this->status;
00070         }
DAOScheduler::get_title (  ) 

Get title for this class.

Returns:
string

Implements ISelfDescribing.

Definition at line 116 of file scheduler.model.php.

00116                                     {
00117                 return $this->name;
00118         }
DAOScheduler::is_active (  ) 

check if status active

Implements IStatusHolder.

Definition at line 75 of file scheduler.model.php.

00075                                     {
00076                 return 
00077                 $this->status == Scheduler::STATUS_ACTIVE 
00078                 ||
00079                 $this->status == Scheduler::STATUS_RESCHEDULED;
00080         }
DAOScheduler::is_deleted (  ) 

Check if status is deleted.

Returns:
boolean

Implements IStatusHolder.

Definition at line 103 of file scheduler.model.php.

00103                                      {
00104                 return false;
00105         }
DAOScheduler::is_disabled (  ) 

check if status is disabled

Implements IStatusHolder.

Definition at line 85 of file scheduler.model.php.

00085                                       {
00086                 return $this->status == Scheduler::STATUS_DISABLED;
00087         }
DAOScheduler::is_unconfirmed (  ) 

Check if status is unconfirmed.

Returns:
boolean

Implements IStatusHolder.

Definition at line 94 of file scheduler.model.php.

00094                                          {
00095                 return false;
00096         }
DAOScheduler::set_status ( status  ) 

set status

Implements IStatusHolder.

Definition at line 61 of file scheduler.model.php.

00061                                             {
00062                 $this->status = $status;
00063         }
DAOScheduler::validate (  ) 

Validate this object.

Returns:
Status Error

Reimplemented from DataObjectBase.

Definition at line 47 of file scheduler.model.php.

00047                                    {
00048                 if (empty($this->name)) {
00049                         $this->name = $this->action;
00050                 }
00051                 return parent::validate();
00052         }

Member Data Documentation

DAOScheduler::$action

Definition at line 13 of file scheduler.model.php.

DAOScheduler::$error_message

Definition at line 15 of file scheduler.model.php.

DAOScheduler::$id

Definition at line 7 of file scheduler.model.php.

DAOScheduler::$name

Definition at line 14 of file scheduler.model.php.

DAOScheduler::$reschedule_error

Definition at line 9 of file scheduler.model.php.

DAOScheduler::$reschedule_success

Definition at line 10 of file scheduler.model.php.

DAOScheduler::$runs_error

Definition at line 11 of file scheduler.model.php.

DAOScheduler::$runs_success

Definition at line 12 of file scheduler.model.php.

DAOScheduler::$scheduledate

Definition at line 8 of file scheduler.model.php.

DAOScheduler::$status

Definition at line 16 of file scheduler.model.php.


The documentation for this class was generated from the following file: