Example #1
0
 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();
     $image = Image::OnImageUpload($_FILES['file'], $attributes);
     if (PEAR::isError($image)) {
Example #2
0
 /**
  * Set the ID of the author who wrote this article.
  *
  * @param int $p_value
  * @return boolean
  */
 public function setAuthor(Author $p_author)
 {
     $defaultAuthorType = $p_author->setType();
     // Links the author to the article
     $articleAuthorObj = new ArticleAuthor($this->getArticleNumber(),
                                           $this->getLanguageId(),
                                           $p_author->getId(), $defaultAuthorType);
     if (!$articleAuthorObj->exists()) {
         $articleAuthorObj->create();
     }
 } // fn setAuthor
Example #3
0
	}
}

// Update the article author
if (!empty($f_article_author)) {
    ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
    $i = 0;
    foreach ($f_article_author as $author) {
        $authorObj = new Author($author);
        if (!$authorObj->exists()  && strlen(trim($author)) > 0) {
            $authorData = Author::ReadName($author);
            $authorObj->create($authorData);
        }
        // Sets the author type selected
        $author_type = $f_article_author_type[$i];
        $authorObj->setType($author_type);
        // Links the author to the article
        $articleAuthorObj = new ArticleAuthor($articleObj->getArticleNumber(),
                                              $articleObj->getLanguageId(),
                                              $authorObj->getId(), $author_type);
        if (!$articleAuthorObj->exists()) {
            $articleAuthorObj->create();
        }
        $i++;
    }
}

// Update the article.
$articleObj->setOnFrontPage(!empty($f_on_front_page));
$articleObj->setOnSectionPage(!empty($f_on_section_page));
$articleObj->setIsPublic(!empty($f_is_public));