AuthorAssignedType::ResetAuthorAssignedTypes PHP Method

ResetAuthorAssignedTypes() public static method

public static ResetAuthorAssignedTypes ( integer $p_authorId = null ) : void
$p_authorId integer
return void
    public static function ResetAuthorAssignedTypes($p_authorId = null)
    {
        if (!is_null($p_authorId)) {
            self::OnAuthorDelete($p_authorId);
        } else {
            $queryStr = 'DELETE FROM ' . self::TABLE;
            $g_ado_db->Execute($queryStr);
        }
    }

Usage Example

コード例 #1
0
ファイル: authors.php プロジェクト: kartoffelkage/Newscoop
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();