/** * @return boolean */ public function delete() { if (!$this->exists()) { return false; } // Unlink articles ArticleAuthor::OnAuthorTypeDelete($this->getId()); // Unlink authors AuthorAssignedType::OnAuthorTypeDelete($this->getId()); // Delete this author type $authorType = $this->getName(); $result = parent::delete(); return $result; }
if ($can_save) { $author = new Author(); if ($id > 0) { $author = new Author($id); $isNewAuthor = false; } else { $author->create(array('first_name' => $first_name, 'last_name' => $last_name)); $isNewAuthor = true; } $uploadFileSpecified = isset($_FILES['file']) && isset($_FILES['file']['name']) && !empty($_FILES['file']['name']); $author->setFirstName($first_name); $author->setLastName($last_name); $author->commit(); // Reset types $types = Input::Get('type', 'array', array()); AuthorAssignedType::ResetAuthorAssignedTypes($author->getId()); foreach ($types as $type) { $author->setType($type); } $author->setSkype(Input::Get('skype')); $author->setJabber(Input::Get('jabber')); $author->setAim(Input::Get('aim')); $author->setEmail(Input::Get('email')); $authorBiography = array(); $authorBiography['biography'] = Input::Get("txt_biography", "string"); $authorBiography['language'] = Input::Get("lang", "int", 0); $authorBiography['first_name'] = Input::Get("lang_first_name"); $authorBiography['last_name'] = Input::Get("lang_last_name"); $author->setBiography($authorBiography); if ($uploadFileSpecified) { $attributes = array();
/** * @param int $p_typeId * @return void */ public function setType($p_typeId = NULL) { if (is_null($p_typeId)) { $p_typeId = $this->__getDefaultType(); } $assignedType = new AuthorAssignedType($this->getId(), (int) $p_typeId); if (!$assignedType->exists()) { $assignedType->create(); } return (int) $assignedType->getAuthorTypeId(); }
/** * @return boolean */ public function delete() { if (!$this->exists()) { return false; } // Unlink articles ArticleAuthor::OnAuthorTypeDelete($this->getId()); // Unlink authors AuthorAssignedType::OnAuthorTypeDelete($this->getId()); // Delete this author type $authorType = $this->getName(); $result = parent::delete(); if ($result) { if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logText = getGS('Article type "$1" deleted.', $authorType); Log::Message($logText, null, 176); } return $result; }