/** * Creates a new overview event. * * @param int ovent type id * @param int time * @param mixed event id (may be null) * @param int relational id * @param array additional fields * @param bool checked * @param mixed data * @return Ovent */ public static function create($oventTypeID, $time, $eventID, $relationalID, $additionalFields = array(), $checked = 0, $data = array()) { if (!is_array($data)) { $data = array($data); } $oventID = self::insert($oventTypeID, $time, $eventID, $relationalID, $additionalFields, $checked, $data); return Ovent::getByOventID($oventID); }
/** * @see Page::readData() */ public function readData() { parent::readData(); $this->ovents = Ovent::getByConditions(array('userID' => WCF::getUser()->userID, 'checked' => 0)); $this->hovents = Ovent::getByConditions(array('userID' => WCF::getUser()->userID, 'checked' => 1)); // news WCF::getCache()->addResource('news-' . PACKAGE_ID, WCF_DIR . 'cache/cache.news-' . PACKAGE_ID . '.php', LW_DIR . 'lib/system/cache/CacheBuilderNews.class.php'); $this->news = WCF::getCache()->get('news-' . PACKAGE_ID); }
public function __construct($oventID, $row = null) { parent::__construct($oventID, $row); if (self::$fleetOverview === null) { self::$fleetOverview = new FleetOverview(); } if (!in_array($this->fleetID, self::$registeredFleetIDs)) { self::$fleetOverview->add($this->missionID, $this->resources['metal'], $this->resources['crystal'], $this->resources['deuterium']); self::$registeredFleetIDs[] = $this->fleetID; } }
/** * Creates a new overview event. * * @param int ovent type id * @param int time * @param mixed event id (may be null) * @param int relational id * @param array additional fields * @param bool checked * @param mixed data * @return Ovent */ public static function create($oventTypeID, $time, $eventID, $relationalID, $additionalFields = array(), $checked = 0, $data = array()) { if (!is_array($data)) { $data = array($data); } $oventID = self::insert($oventTypeID, $time, $eventID, $relationalID, $additionalFields, $checked, $data); $oventObj = Ovent::getByOventID($oventID); if (isset($additionalFields['userID']) && UserSettings::getSetting($additionalFields['userID'], 'hideOventType' . $oventTypeID)) { $oventObj->getEditor()->check(); } return $oventObj; }
/** * @see Action::execute() */ public function execute() { parent::execute(); // check permission if (!WCF::getUser()->userID) { die('invalid userID'); } $ovent = Ovent::getByOventID($this->oventID); if ($ovent === null || $ovent->userID != WCF::getUser()->userID) { die('invalid oventID'); } $ovent->getEditor()->setHighlighted($this->highlighted == true); $this->executed(); die('done'); }
/** * Updates the building ovent for a planet. * * @param int planet id */ public static function check($planetID) { $ovents = Ovent::getByConditions(array('planetID' => $planetID, 'oventTypeID' => self::OVENT_TYPE_ID)); $planet = Planet::getInstance($planetID); // event needed if ($planet->b_building > time()) { if (isset($ovents[0])) { if ($ovents[0]->time == $planet->b_building) { // no changes needed return; } // delete old ovent $ovents[0]->getEditor()->delete(); } // create new $data = self::getData($planet); $fields = array('userID' => $planet->id_owner, 'planetID' => $planetID); OventEditor::create(self::OVENT_TYPE_ID, $planet->b_building, null, $planetID, $fields, 0, $data); } else { foreach ($ovents as $ovent) { $ovent->getEditor()->delete(); } } }
/** * Updates the fleet data of the return events. */ public static function update(Fleet $fleet) { $ovents = Ovent::getByConditions(array('oventTypeID' => self::OVENT_TYPE_ID, 'relationalID' => $fleet->fleetID), true); foreach ($ovents as $ovent) { $ovent->getEditor()->update(); } }
/** * @see Page::readData() */ public function readData() { parent::readData(); $this->ovents = Ovent::getByConditions(array('userID' => WCF::getUser()->userID, 'checked' => 1)); }
/** * Reads the cache data. */ protected static function initCache() { if (!count(self::$cache)) { WCF::getCache()->addResource('oventTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.oventTypes-' . PACKAGE_ID . '.php', LW_DIR . 'lib/system/cache/CacheBuilderOventTypes.class.php'); self::$cache = WCF::getCache()->get('oventTypes-' . PACKAGE_ID); } }