/** * Insert a song into the play history. * @param Slay_Song $song * @param int $time_end */ public static function insertPlayed(Slay_Song $song, $time_end) { if (self::getLastID() === $song->getID()) { return true; } $date = GWF_Time::getDate(GWF_Date::LEN_SECOND, $time_end - $song->getVar('ss_duration')); if (false === $song->saveVar('ss_last_played', $date)) { return false; } return self::table(__CLASS__)->insertAssoc(array('sph_id' => 0, 'sph_sid' => $song->getID(), 'sph_date' => $date), false); }
private function formEdit(Slay_Song $song) { $data = array('bpm' => array(GWF_Form::INT, $song->getVar('ss_bpm'), $this->l('th_bpm')), 'key' => array(GWF_Form::ENUM, $song->displayKey(), $this->l('th_key'), '', Slay_Key::data()), 'edit' => array(GWF_Form::SUBMIT, $this->module->lang('btn_edit')), 'flush_tags' => array(GWF_Form::SUBMIT, $this->module->lang('btn_flush_tags'))); return new GWF_Form($this, $data); }