当前位置: 首页>>代码示例>>PHP>>正文


PHP Album::save方法代码示例

本文整理汇总了PHP中Album::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::save方法的具体用法?PHP Album::save怎么用?PHP Album::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Album的用法示例。


在下文中一共展示了Album::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showSeedAlbum

 public function showSeedAlbum()
 {
     $album = new Album();
     $album->title = 'Some Mad Hope';
     $album->artist = 'Matt Nathanson';
     $album->genre = 'Acoustic Rock';
     $album->year = 2007;
     $album->save();
     $album = new Album();
     $album->title = 'Please';
     $album->artist = 'Matt Nathanson';
     $album->genre = 'Acoustic Rock';
     $album->year = 1993;
     $album->save();
     $album = new Album();
     $album->title = 'Leaving Throught The Window';
     $album->artist = 'Something Corp';
     $album->genre = 'Piano Rock';
     $album->year = 2002;
     $album->save();
     $album = new Album();
     $album->title = '...Anywhere But here';
     $album->artist = 'Something Corp';
     $album->genre = 'Punk Rock';
     $album->year = 1997;
     $album->save();
     $album = new Album();
     $album->title = '...Is A Real Boy';
     $album->artist = 'Something Corp';
     $album->genre = 'Indie Rock';
     $album->year = 2006;
     $album->save();
 }
开发者ID:nattaphat,项目名称:cuse2,代码行数:33,代码来源:AlbumController.php

示例2: actionCreate

 public function actionCreate()
 {
     $model = new Album();
     if (isset($_POST['Album']) || isset($_POST['Page'])) {
         if (isset($_POST['Album'])) {
             $model->setAttributes($_POST['Album']);
         }
         if (isset($_POST['Album']['page'])) {
             $model->page = $_POST['Album']['page'];
         }
         if (isset($_POST['Album']['thumbnail'])) {
             $model->thumbnail = $_POST['Album']['thumbnail'];
         }
         try {
             if ($model->save()) {
                 if (isset($_GET['returnUrl'])) {
                     $this->redirect($_GET['returnUrl']);
                 } else {
                     $this->redirect(array('view', 'id' => $model->id));
                 }
             }
         } catch (Exception $e) {
             $model->addError('', $e->getMessage());
         }
     } elseif (isset($_GET['Album'])) {
         $model->attributes = $_GET['Album'];
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:awecode,项目名称:awecms,代码行数:29,代码来源:AlbumController.php

示例3: store

 public function store()
 {
     $data = Input::all();
     $album = new Album();
     $album['title'] = $data['title'];
     $album['user_id'] = Session::get('user')['id'];
     $album['privacy'] = $data['privacy'];
     $file = Input::file('img');
     $folder_user = Session::get('user')['account'];
     $album_path = 'public/upload/' . $folder_user . '/' . uniqid(date('ymdHisu'));
     foreach ($file as $key => $f) {
         $name = uniqid() . "." . $f->getClientOriginalExtension();
         $f->move($album_path, $name);
         if ($key == 0) {
             //                $album['album_img'] = $name;
             $album->save();
             FEEntriesHelper::save($album->id, FEEntriesHelper::getId("Album"), $album->user_id, $album->privacy);
         }
         $path = $album_path . '/' . $name;
         $image = new Image();
         $image['path'] = $path;
         $image['user_id'] = Session::get('user')['id'];
         $image['album_id'] = $album['id'];
         $image['width'] = getimagesize($path)[0];
         $image['height'] = getimagesize($path)[1];
         $image->save();
     }
     echo json_encode($file);
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:29,代码来源:FEAlbumsController.php

示例4: unpublishSubalbums

function unpublishSubalbums($album)
{
    global $gallery;
    $albums = $album->getAlbums();
    foreach ($albums as $albumname) {
        $subalbum = new Album($gallery, $albumname);
        $subalbum->setShow(false);
        $subalbum->save();
        unpublishSubalbums($subalbum);
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:11,代码来源:scheduled_content.php

示例5: set_album

 public function set_album($album_str)
 {
     if (!Albums::get_by_name($album_str)) {
         $album = new Album();
         $album->set_name($album_str);
         $album->save();
     } else {
         $album = Albums::get_by_name($album_str);
     }
     $this->music_album = $album->get_id();
 }
开发者ID:radiowarwick,项目名称:digiplay,代码行数:11,代码来源:Track.php

示例6: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Album();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Album'])) {
         $model->attributes = $_POST['Album'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:google-code-backups,项目名称:yii-vn,代码行数:17,代码来源:AlbumController.php

示例7: testCreateAlbum

	/** 
	 * TC12: Create operation on Albums
	*	Test to verify that the database can save new albums
	*	The test is performed by creating an album object with the required input fields
	*	Once the test is complete no errors will appear and the album will be in the database
	*/
	public function testCreateAlbum() {
		//Create the album
		$album = new Album();

		$album['artist_id'] = $this->artist['artist_id'];
		$album['name'] = 'testalbum2';
		$album['added_by_user_id'] = 1; //SYSTEM user

		$album->save();
		
		//Verify it exist now
		$this->assertTrue($album->exists());
	}
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:19,代码来源:AlbumTest.php

示例8: postCreate

 public function postCreate()
 {
     //Todo: validate
     $name = $_POST['name'];
     if ($name === '') {
         return View::make('albums.create');
     }
     $album = new Album();
     $album->name = $name;
     $album->owner_id = Auth::user()->id;
     $album->save();
     return Redirect::to('/albums/own');
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:13,代码来源:AlbumsController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = ['nama' => 'required'];
     $pesan = ['nama.required' => 'Nama harus diisi'];
     $validasi = Validator::make(Input::all(), $rules, $pesan);
     if ($validasi->fails()) {
         return Redirect::back()->withErrors($validasi);
     } else {
         $album = new Album();
         $album->nm_album = Input::get('nama');
         $album->created_by = Sentry::getUser()->username;
         $album->save();
         $theId = DB::getPdo()->lastInsertId();
         return Redirect::to('admin/gallery/' . $theId . '/tambahfoto');
     }
 }
开发者ID:jamalapriadi,项目名称:sia,代码行数:21,代码来源:AlbumController.php

示例10: updateAlbum

 public function updateAlbum(Album $album)
 {
     $inputs = ['name' => Input::get('name'), 'description' => Input::get('description'), 'user_id' => Input::get('uid')];
     $valid = Validator::make($inputs, Album::$rules);
     if ($valid->passes()) {
         $album->name = $inputs['name'];
         $album->description = $inputs['description'];
         $album->user_id = $inputs['user_id'];
         if (count($album->getDirty()) > 0) {
             $album->save();
             return Redirect::back()->with('success', Lang::choice('messages.Albums', 1) . ' ' . trans('messages.is updated'));
         } else {
             return Redirect::back()->with('success', trans('messages.Nothing to update'));
         }
     } else {
         return Redirect::back()->withErrors($valid)->withInput();
     }
 }
开发者ID:rituzy,项目名称:iblog,代码行数:18,代码来源:AlbumController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::except(array('_token', '_method'));
     $trimmedData = $this->trimData($data, array());
     $album = Album::where('name', $trimmedData['name'])->get()->first();
     if (!empty($album)) {
         Session::flash('flash_error', trans('message.album.error.already_exist'));
         return Redirect::route('secured.album.create')->withInput();
     }
     $currentUser = $this->getCurrentUser();
     $album = new Album();
     $album->fill($trimmedData);
     $album->owner_id = $currentUser->id;
     if (!$album->save()) {
         $errors = $album->errors();
         return Redirect::route('secured.album.create')->withInput()->withErrors($errors);
     }
     return Redirect::route('secured.album.index');
 }
开发者ID:hungdo89,项目名称:file-manager,代码行数:24,代码来源:AlbumController.php

示例12: checkAlbumParentid

function checkAlbumParentid($albumname, $id)
{
    global $gallery;
    $album = new Album($gallery, $albumname);
    $oldid = $album->get('parentid');
    if ($oldid !== $id) {
        $album->set('parentid', $id);
        $album->save();
        if (is_null($oldid)) {
            $oldid = '<em>NULL</em>';
        }
        if (is_null($id)) {
            $id = '<em>NULL</em>';
        }
        printf('Fixed album <strong>%1$s</strong>: parentid was %2$s should have been %3$s<br />', $albumname, $oldid, $id);
    }
    $id = $album->id;
    $albums = $album->getSubalbums();
    foreach ($albums as $albumname) {
        checkAlbumParentid($albumname, $id);
    }
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:22,代码来源:setup.php

示例13: actionCreate

 /**
  * Creates a new album with optional album cover.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $user = $this->getUser();
     if ($user->id != Yii::app()->user->id) {
         throw new CHttpException(403, 'You can create album only on your profile.');
     }
     $this->subLayout = "application.modules.album.views._layout";
     $model = new Album();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Album'])) {
         $_POST = Yii::app()->input->stripClean($_POST);
         $_POST['containerGuid'] = Yii::app()->user->guid;
         $_POST['containerClass'] = 'User';
         $model->content->populateByForm();
         $model->attributes = $_POST['Album'];
         if ($model->save()) {
             PublicFile::attachPrecreated($model, Yii::app()->request->getParam('cover'));
             $this->redirect(['/album/view', 'id' => $model->id, 'username' => $user->username, 'uguid' => $user->guid]);
         }
     }
     $this->render('/album/create', ['model' => $model, 'user' => $user]);
 }
开发者ID:rafapaul,项目名称:humhub-modules-album,代码行数:27,代码来源:CreateController.php

示例14: saveAlbum

 public function saveAlbum()
 {
     $validator = Validator::make(Input::all(), array('album_title' => 'required|unique:albums,title'));
     if ($validator->fails()) {
         return Redirect::route('edit-albums')->withInput()->withErrors($validator)->with('modal', '#album_form');
     } else {
         $album = new Album();
         $album->title = Input::get('album_title');
         $album->release = Input::get('album_release');
         $slug = strtolower(Input::get('album_title'));
         //Make alphanumeric (removes all other characters)
         $slug = preg_replace("/[^a-z0-9_\\s-]/", "", $slug);
         //Clean up multiple dashes or whitespaces
         $slug = preg_replace("/[\\s-]+/", " ", $slug);
         //Convert whitespaces and underscore to dash
         $slug = preg_replace("/[\\s_]/", "-", $slug);
         $album->slug = $slug;
         if ($album->save()) {
             return Redirect::route('edit-albums')->with('success', 'The album was added.');
         } else {
             return Redirect::route('edit-albums')->with('fail', 'An error occured while saving the new album.');
         }
     }
 }
开发者ID:kylehagler,项目名称:CHP,代码行数:24,代码来源:AlbumsController.php

示例15: addAlbum

 /**
  * Add an Album to the database or get its key if it exists
  * @param name str: the name of the album to add
  * @return     int: the primary key added or found
  */
 public function addAlbum($name)
 {
     //is this name already in the collection?
     $q = Doctrine_Query::create()->select('a.id')->from('Album a')->where('a.name = ?', $name);
     $result = $q->fetchOne();
     if (is_object($result) && $result->id > 0) {
         $retId = $result->id;
         unset($q, $result);
         return (int) $retId;
     } else {
         $item = new Album();
         $item->name = $name;
         if ($name == 'Unknown Album') {
             $item->has_art = 1;
             //there's no point scanning an unknown album for art
         }
         $item->scan_id = 1;
         $item->save();
         $id = $item->getId();
         $item->free();
         unset($item, $q, $result);
         return (int) $id;
     }
 }
开发者ID:Alenpiera,项目名称:streeme,代码行数:29,代码来源:AlbumTable.class.php


注:本文中的Album::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。