/** * Keys to insert * @return array */ protected function keys() { return array_merge(array(self::ACCOUNTID), Entity::allDatabaseProperties()); }
/** * @param \Runalyze\Model\EquipmentType\Entity $EquipmentType * @param boolean $inuse */ protected function showListFor(Model\EquipmentType\Entity $EquipmentType, &$inuse) { $max = 0; $showDistance = $EquipmentType->hasMaxDistance(); $hasMaxDuration = $showDistance || $EquipmentType->hasMaxDuration(); $allEquipment = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'equipment` WHERE `typeid`="' . $EquipmentType->id() . '" AND `accountid`="' . SessionAccountHandler::getId() . '" ORDER BY ISNULL(`date_end`) DESC, `distance` DESC')->fetchAll(); foreach ($allEquipment as $data) { $Object = new Model\Equipment\Entity($data); $Distance = new Distance($Object->totalDistance()); $Duration = new Duration($Object->duration()); if ($inuse && !$Object->isInUse()) { echo '<div id="hiddenequipment" style="display:none;">'; $inuse = false; } if ($max == 0) { $max = $Object->duration(); } echo '<p style="position:relative;"> <span class="right">' . ($showDistance ? $Distance->string() : $Duration->string()) . '</span> <strong>' . SearchLink::to('equipmentid', $Object->id(), $Object->name()) . '</strong> ' . $this->getUsageImage($showDistance ? $Object->totalDistance() / $EquipmentType->maxDistance() : $Object->duration() / ($hasMaxDuration ? $EquipmentType->maxDuration() : max(1, $max))) . ' </p>'; } if (empty($allEquipment)) { echo HTML::em(__('You don\'t have any equipment')); } if (!$inuse) { echo '</div>'; } }