_a['table'] = 'idf_keys'; $this->_a['model'] = __CLASS__; $this->_a['cols'] = array( // It is mandatory to have an "id" column. 'id' => array( 'type' => 'Pluf_DB_Field_Sequence', //It is automatically added. 'blank' => true, ), 'user' => array( 'type' => 'Pluf_DB_Field_Foreignkey', 'model' => 'Pluf_User', 'blank' => false, 'verbose' => __('user'), ), 'content' => array( 'type' => 'Pluf_DB_Field_Text', 'blank' => false, 'verbose' => __('ssh key'), ), ); // WARNING: Not using getSqlTable on the Pluf_User object to // avoid recursion. $t_users = $this->_con->pfx.'users'; $this->_a['views'] = array( 'join_user' => array( 'join' => 'LEFT JOIN '.$t_users .' ON '.$t_users.'.id='.$this->_con->qn('user'), 'select' => $this->getSelect().', ' .$t_users.'.login AS login', 'props' => array('login' => 'login'), ) ); } function showCompact() { return Pluf_Template::markSafe(Pluf_esc(substr($this->content, 0, 25)).' [...] '.Pluf_esc(substr($this->content, -55))); } function postSave($create=false) { /** * [signal] * * IDF_Key::postSave * * [sender] * * IDF_Key * * [description] * * This signal allows an application to perform special * operations after the saving of a SSH Key. * * [parameters] * * array('key' => $key, * 'created' => true/false) * */ $params = array('key' => $this, 'created' => $create); Pluf_Signal::send('IDF_Key::postSave', 'IDF_Key', $params); } function preDelete() { /** * [signal] * * IDF_Key::preDelete * * [sender] * * IDF_Key * * [description] * * This signal allows an application to perform special * operations before a key is deleted. * * [parameters] * * array('key' => $key) * */ $params = array('key' => $this); Pluf_Signal::send('IDF_Key::preDelete', 'IDF_Key', $params); } }