protected function execute($arguments = array(), $options = array()) { $databaseManager = new sfDatabaseManager($this->configuration); $url = sfConfig::get('op_base_url'); if ($arguments['mode'] == "morning") { $message = "おはようございます。昨日の勤怠報告が済んでいない方は報告よろしくお願いします。"; } elseif ($arguments['mode'] == "afternoon") { $message = "お疲れ様です。退勤される方は勤怠報告をよろしくおねがいします。"; } elseif ($arguments['mode'] == "evening") { $message = "お疲れ様です。退勤される方は勤怠報告をよろしくおねがいします。"; } else { $message = ""; } if ($message) { $message = $message . " " . $url . "/kintai"; $activity = new ActivityData(); $activity->setMemberId(1); $activity->setBody($message); $activity->setIsMobile(0); $activity->save(); echo "Posted via Acvitity.\n"; } else { echo "Posted failure. Maybe incorrect arguments.\n"; } }
public function updateActivity($memberId, $body, $options = array()) { $object = new ActivityData(); $object->setMemberId($memberId); $object->setBody($body); if (isset($options['public_flag'])) { $publicFlagKeys = array_keys($this->getPublicFlags(false)); if (!in_array($options['public_flag'], $publicFlagKeys)) { throw new LogicException('Invalid public flag'); } $object->setPublicFlag($options['public_flag']); } if (isset($options['in_reply_to_activity_id'])) { $object->setInReplyToActivityId($options['in_reply_to_activity_id']); } if (isset($options['is_pc']) && !$options['is_pc']) { $object->setIsPc(false); } if (isset($options['is_mobile']) && !$options['is_mobile']) { $object->setIsMobile(false); } if (isset($options['uri'])) { $object->setUri($options['uri']); } if (isset($options['source'])) { $object->setSource($options['source']); if (isset($options['source_uri'])) { $object->setSourceUri($options['source_uri']); } } $activityImages = array(); if (isset($options['images'])) { if (!is_array($options['images'])) { $options['images'] = array($options['images']); } foreach ($options['images'] as $image) { $activityImage = new ActivityImage(); if (isset($image['file_id'])) { $activityImage->setFileId($image['file_id']); } elseif (isset($image['uri']) && isset($image['mime_type'])) { $activityImage->setUri($image['uri']); $activityImage->setMimeType($image['mime_type']); } else { throw new LogicException('Invalid image data'); } $activityImages[] = $activityImage; } } if (isset($options['foreign_table']) && isset($options['foreign_id'])) { $object->setForeignTable($options['foreign_table']); $object->setForeignId($options['foreign_id']); } $object->save(); foreach ($activityImages as $activityImage) { $activityImage->setActivityData($object); $activityImage->save(); } return $object; }