/** * Constructor. * @param string $commentAutor Nombre del autor. * @param string $commentAuthorEmail Email del autor. * @param int $commentStatus Estado del comentario. 0 = Sin aprobar, 1 = Aprobado * @param string $commentContents Contenido del comentario. * @param int $postID Identificador de la entrada/post. * @param int $commentUserID Identificador del autor. */ public function __construct($commentAutor, $commentAuthorEmail, $commentStatus, $commentContents, $postID, $commentUserID) { parent::__construct(Term::getTableName(), self::$COLUMNS, self::$VALUES); $this->commentAutor = $commentAutor; $this->commentAuthorEmail = $commentAuthorEmail; $this->commentStatus = $commentStatus; $this->commentContents = $commentContents; $this->postID = $postID; $this->commentUserID = $commentUserID; }
/** * Metodo llamado por la función UPDATE. * @param int $id * @return array */ protected function dataUpdate($id) { global $urlSite; $term = Term::selectByID($id); //En caso de que no exista. if (empty($term)) { Messages::addError('Error. La etiqueta no existe.'); header("Location: {$urlSite}" . 'admin/term'); exit; } if (filter_input(\INPUT_POST, 'update')) { $dataInput = $this->getDataInput(); $update = new TermUpdate($term, $dataInput['termName'], $dataInput['termDescription']); //Si ocurre un error la función "$update->update()" retorna FALSE. if ($update->update()) { Messages::addSuccess('Etiqueta actualizada correctamente.'); $term = $update->getDataUpdate(); } else { Messages::addError('Error al actualizar la etiqueta.'); } } return ['term' => $term, 'actionUpdate' => \TRUE]; }
/** * Metodo que obtiene todas las etiquetas de la base de datos. * @return Terms */ public static function selectAll() { $select = self::select(Term::getTableName()); return self::getInstanceData($select); }
/** * Metodo que obtiene el objeto con los datos actualizados. * @return Term */ public function getDataUpdate() { //Obtiene el primer dato el cual corresponde al id. $id = $this->prepareStatement[0]['value']; return Term::selectByID($id); }
/** * Constructor. * @param int $id Identificador. */ public function __construct($id) { parent::__construct($id, Term::getTableName()); }
public function __construct($termName, $termDescription) { parent::__construct(Term::getTableName(), self::$COLUMNS, self::$VALUES); $this->termName = $termName; $this->termDescription = $termDescription; }