/** * ダッシュボード * @context OpenpearMaintainer $maintainer ログインしてるメンテナ * @context OpenpearCharge[] $my_package_charges * @context OpenpearTimeline[] $timelines * @context OpenpearFavorite[] $my_favorites * @context OpenpearMessage[] $notices */ public function dashboard() { $this->vars('maintainer', $this->user()); $this->vars('my_packages', C(OpenpearPackage)->find_all(Q::in('id', C(OpenpearCharge)->find_sub('package_id', Q::eq('maintainer_id', $this->user()->id()))), Q::order('-updated'))); $this->vars('timelines', OpenpearTimeline::get_by_maintainer($this->user())); $this->vars('fav_packages', C(OpenpearPackage)->find_all(Q::in('id', C(OpenpearFavorite)->find_sub('package_id', Q::eq('maintainer_id', $this->user()->id()))), Q::order('-updated'))); $this->vars('notices', C(OpenpearMessage)->find_all(Q::eq('maintainer_to_id', $this->user()->id()), Q::eq('type', 'system_notice'), Q::eq('unread', true))); }
protected function __after_save__() { self::recount_favorites($this->package_id()); C($this)->commit(); $timeline = new OpenpearTimeline(); $timeline->subject(sprintf('<a href="%s">%s</a> <span class="hl">liked</span> <a href="%s">%s</a>', url('maintainer/' . $this->maintainer()->name()), R(Templf)->htmlencode(str($this->maintainer())), url('package/' . $this->package()->name()), $this->package()->name())); $timeline->description(sprintf('<a href="%s">%s</a>: latest %s. %d fans.', url('package/' . $this->package()->name()), $this->package()->name(), $this->package()->latest_release()->fm_version(), C(OpenpearFavorite)->find_count(Q::eq('package_id', $this->package_id())))); $timeline->type('favorite'); $timeline->package_id($this->package_id()); $timeline->maintainer_id($this->maintainer_id()); $timeline->save(); }
protected function __after_create__($commit) { $maintainer = $this->maintainer(); $package = $this->package(); $timeline = new OpenpearTimeline('type=release'); $timeline->subject(sprintf('<a href="%s">%s</a> <span class="hl">released</span> <a href="%s">%s %s</a>', url('maintainer/' . $maintainer->name()), $maintainer->name(), url('package/' . $package->name()), $package->name(), $this->fm_version())); $timeline->description(sprintf('Download: <a href="%s">%s</a>.<pre>pear install openpear/%s-%s</pre>', url("package/{$package->name()}/downloads#{$this->id()}"), $this->fm_version(), $package->name(), $this->version_stab == 'stable' ? $this->version() : $this->version_stab)); $timeline->package_id($this->package_id()); $timeline->maintainer_id($this->maintainer_id()); $timeline->save(); }
/** * 作成後処理 */ protected function __after_create__() { // TODO 美しくない $path = preg_replace('@^file://@', '', OpenpearConfig::svn_root()); $message = Subversion::look('log', array($path), array('revision' => $this->revision)); $timeline = new OpenpearTimeline(); $timeline->subject(sprintf('<a href="%s">%s</a> <span class="hl">committed</span> to <a href="%s">%s</a>', url('maintainer/' . $this->maintainer()->name()), $this->maintainer()->name(), url('package/' . $this->package()->name()), $this->package()->name())); $timeline->description(sprintf('Changeset <a href="%s">[%d]</a>.<br />%s', url(sprintf('changeset/%d', $this->revision)), $this->revision, nl2br(htmlspecialchars(Text::substring($message, 0, 200, 'utf-8'), ENT_QUOTES)))); $timeline->type('changeset'); $timeline->package_id($this->package_id()); $timeline->maintainer_id($this->maintainer_id()); $timeline->save(); }
protected function __after_create__($commit) { if (!$this->is_external_repository()) { $queue = new OpenpearNewprojectQueue(); $queue->package_id($this->id()); $queue->maintainer_id($this->author_id()); $queue->save(); } $created_message = new Template(); $created_message->vars('package', $this); $message = new OpenpearPackageMessage(); $message->package_id($this->id()); $message->description($created_message->read('messages/created.txt')); $message->save(); $timeline = new OpenpearTimeline(); $timeline->subject(sprintf('<a href="%s">%s</a> <span class="hl">created</span> a new package: <a href="%s">%s</a>', url('maintainer/' . $this->author()->name()), $this->author()->name(), url('package/' . $this->name()), $this->name())); $timeline->description(htmlspecialchars($this->description())); $timeline->type('package_setting'); $timeline->package_id($this->id()); $timeline->maintainer_id($this->author_id()); $timeline->save(); }