public function homeAction() { $this->view->page = $page = new Pages_Model_Zupalpages(1); $aid = $page->get_atomic_id(); $m = Model_Zupalbonds::getInstance(); $this->view->pages = $m->get_bonds_to($aid, 'parent', 'from_atom'); }
/** * * @param variant $pType = NULL * @return Model_Zupalbonds[] */ public function get_bonds($pType = NULL, Model_ZupalatomIF $pTarget = NULL, Model_ZupalatomIF $bond_atom = NULL) { return Model_Zupalbonds::getInstance()->get_bonds_from($this, $pType); }
/** * * @param int | Model_users $pUser = NULL */ public function add_user($pUser = NULL) { if ($pUser) { $pUser = Zupal_Domain_Abstract::_as($pUser, 'Model_Users'); } else { $pUser = Model_Users::current_user(); } if (!$pUser) { throw new Exception(__METHOD__ . ': user missing'); } $active_bond = Model_Zupalbonds::getInstance()->make_unique_bond(array('bond_atom' => $this->game_type(), 'from_atom' => $pUser, 'type' => self::ACTIVE_KEY)); $active_bond->set_to_atom($this); return $active_bond; }
/** * * @param id | Model_ZupalatomIF $pTarget * @return void */ public function unbond($pTarget, $pType = NULL, Model_ZupalatomIF $bond_atom = NULL) { $params = array('from_atom' => $this->get_atomic_id(), 'from_model_class' => $this->get_model_class(), 'type' => $pType, 'to_atom' => $pTarget->get_atomic_id()); if ($bond_atom) { $params['bond_atom'] = $bond_atom->get_atomic_id(); } if ($found = Model_Zupalbonds::getInstance()->find($params)) { foreach ($found as $bond) { $bond->delete(); } } }