Guest User

Untitled

a guest
Apr 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.85 KB | None | 0 0
  1. public function relations()
  2.     {
  3.         // NOTE: you may need to adjust the relation name and the related
  4.         // class name for the relations automatically generated below.
  5.         return array('calls' => array(self::HAS_MANY, 'Call', 'submitter'),
  6.             'callResponses' => array(self::HAS_MANY, 'CallResponse', 'emp_id'),
  7.             'jobs' => array(self::HAS_MANY, 'Job', 'emp_id'),
  8.             'logs' => array(self::HAS_MANY, 'Log', 'emp_id_affected'),
  9.             'times' => array(self::HAS_MANY, 'Time', 'emp_id'),
  10.             'position0' => array(self::BELONGS_TO, 'Position', 'position'),
  11.             'memberTeams' => array(self::HAS_MANY, 'MemberTeam', 'member'),
  12.             'trainingos' => array(self::HAS_MANY, 'MemberTrainingo', 'emp_id',
  13.                 'join'=>'INNER JOIN `trainingo` as `to` '.
  14.                     'ON `t`.`training_id`=`to`.`training_id`',
  15.                 'select'=>'`to`.`name`'),
  16.             'memberTrainingos' => array(self::HAS_MANY, 'MemberTrainingo', 'emp_id',
  17.                 'join'=>'INNER JOIN `trainingo` as `to` '.
  18.                     'ON `memberTrainingos`.`training_id`=`to`.`training_id`'),
  19.             'memberTrainingoCount' => array(self::STAT, 'MemberTrainingo', 'emp_id',
  20.                 'condition' => '`expire`>' . time()),
  21.             'memberTrainingoRCount' => array(self::STAT, 'MemberTrainingo', 'emp_id',
  22.                 'condition' => '`raise`=1 AND `expire`>' . time()),
  23.             'totalHours' => array(self::STAT, 'Time', 'emp_id',
  24.                 'select' => 'sum(`hours`)'),
  25.             'totalPay' => array(self::STAT, 'Time', 'emp_id',
  26.                 'select' => 'sum(`pay`)'),
  27.             'jobCount' => array(self::STAT, 'Job', 'emp_id',
  28.                 'condition' => '`valid_start`<'.time().' AND `valid_end`>'.time()),
  29.             'events' => array(self::HAS_MANY, 'Event', 'supervisor'),
  30.             'notes' => array(self::MANY_MANY, 'Notes',
  31.                 'notes_completers(emp_id, NotesID)'),
  32.             'notesTemplates' => array(self::MANY_MANY, 'NotesTemplate',
  33.                 'notes_template_email(emp_id, nTempID)'),
  34.             'allRating' => array(self::STAT, 'Time', 'emp_id',
  35.                 'select' => "AVG(`rating`)"),
  36.             'all6mRating' => array(self::STAT, 'Time', 'emp_id',
  37.                 'select' => "AVG(`rating`)",
  38.                 'condition' => '`out` >= '.($_SERVER['REQUEST_TIME']-15768000)),
  39.             'crewRating' => array(self::STAT, 'Time', 'emp_id',
  40.                 'select' => "AVG(`rating`)",
  41.                 'condition' => '`t`.`crew`='.Member::$crewStat),
  42.             'crew6mRating' => array(
  43.                 self::STAT, 'Time', 'emp_id',
  44.                 'select' => "AVG(`rating`)",
  45.                 'condition' => '`t`.`crew`='.Member::$crewStat.' AND `out` >= '.
  46.                     ($_SERVER['REQUEST_TIME']-15768000)
  47.             ),
  48.         );
Add Comment
Please, Sign In to add comment