Differential D7326 Diff 16500 src/applications/phrequent/conduit/ConduitAPI_phrequent_start_Method.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phrequent/conduit/ConduitAPI_phrequent_start_Method.php
- This file was added.
<?php | |||||
/** | |||||
*@group conduit | |||||
*/ | |||||
final class ConduitAPI_phrequent_start_Method | |||||
extends ConduitAPI_phrequent_Method { | |||||
public function getMethodDescription() { | |||||
return "Start tracking time on an object."; | |||||
} | |||||
public function getMethodStatus() { | |||||
return self::METHOD_STATUS_UNSTABLE; | |||||
} | |||||
public function defineParamTypes() { | |||||
return array( | |||||
'object' => 'required phid' | |||||
); | |||||
} | |||||
public function defineReturnType() { | |||||
return 'bool'; | |||||
} | |||||
public function defineErrorTypes() { | |||||
return array( | |||||
); | |||||
} | |||||
protected function execute(ConduitAPIRequest $request) { | |||||
$user_id = $request->getUser()->getPHID(); | |||||
$object_id = $request->getValue('object'); | |||||
$usertime = new PhrequentUserTime(); | |||||
$usertime->setDateStarted(time()); | |||||
$usertime->setUserPHID($user_id); | |||||
$usertime->setObjectPHID($object_id); | |||||
$usertime->save(); | |||||
return true; | |||||
} | |||||
} |