public function testRenderWithTitleAndAutoplayMuted() { $audio = Audio::create()->withURL('http://foo.com/mp3')->withTitle('audio title')->enableMuted()->enableAutoplay(); $expected = '<audio title="audio title" autoplay="autoplay" muted="muted">' . '<source src="http://foo.com/mp3"/>' . '</audio>'; $rendered = $audio->render(); $this->assertEquals($expected, $rendered); }
public function testRenderWithAudio() { $audio = Audio::create()->withURL('http://foo.com/mp3')->withTitle('audio title')->enableMuted()->enableAutoplay(); $expected_audio = '<audio title="audio title" autoplay="autoplay" muted="muted">' . '<source src="http://foo.com/mp3"/>' . '</audio>'; $slideshow = SlideShow::create()->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home2.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home3.jpg'))->withAudio($audio); $expected = '<figure class="op-slideshow">' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home2.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home3.jpg"/>' . '</figure>' . $expected_audio . '</figure>'; $rendered = $slideshow->render(); $this->assertEquals($expected, $rendered); }
function render() { $collection_id = $_GET['gid']; $audio_ids = Audio::load_audios_for_collection_id($collection_id, $limit = 0); $this->links = $audio_ids; $this->audios_links = $audio_ids; $this->inner_HTML = $this->generate_inner_html(); $content = parent::render(); return $content; }
<?php Output::set_template(); if (isset($_REQUEST["key"])) { $location = Locations::get_by_key($_REQUEST["key"]); $key = $_REQUEST["key"]; } else { if (isset($_REQUEST["location"])) { $location = Locations::get_by_id($_REQUEST["location"]); $key = $location->get_key(); } else { exit("No location specified!"); } } switch ($_REQUEST["action"]) { case "check-next": $next = Configs::get(NULL, $location, "next_on_showplan")->get_val(); if ($next == "") { echo json_encode(array("response" => "false")); } else { echo json_encode(array("response" => "true", "md5" => $next)); } break; case "load-player": $config = Configs::get(NULL, $location, "next_on_showplan"); $audio = Audio::get_by_md5($config->get_val()); $config->set_val(""); echo json_encode(array("response" => "success", "title" => $audio->get_title(), "artist" => $audio->get_artists_str())); break; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Audio the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Audio::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
try { if(isset($_GET['action']) && ($_GET['action']=='delete') && ($login_uid)) { $id = $_GET['id']; $type = $_POST['media_type']; $album_id = $_POST['album_id']; if ($_GET['type'] == 'image') { $new_image = new Image(); $new_image->content_id = $id; $new_image->delete($id); $msg = 2004; header("Location: $base_url/media_gallery.php?type=$type&msg_id=$msg&album_id=$album_id"); exit; } if ($_GET['type'] == 'audio') { $new_image = new Audio(); $new_image->content_id = $id; $new_image->delete($id); $msg = 2005; header("Location: $base_url/media_gallery.php?type=$type&msg_id=$msg&album_id=$album_id"); exit; } if ($_GET['type'] == 'video') { $new_image = new Video(); $new_image->content_id = $id; $new_image->delete($id); $msg = 2006; header("Location: $base_url/media_gallery.php?type=$type&msg_id=$msg&album_id=$album_id"); exit; }
public function get_audio() { return Audio::get_by_id($audioid); }
function generate_inner_html() { global $login_uid; if (!isset($_GET['gid']) || empty($_GET['gid'])) { parent::set_vars(); $frnd_list = null; if (!empty($_GET['view'])) { $frnd_list = $this->friend_list; } $sb_audios = array(); $new_album = new Album(AUDIO_ALBUM); if ($this->album_id) { $new_album = new Album(); $new_album->album_type = AUDIO_ALBUM; $new_album->load((int) $this->album_id); $audio_data['album_id'] = $new_album->collection_id; $audio_data['album_name'] = $new_album->title; } else { $new_album->collection_id = $this->default_album_id; $audio_data['album_id'] = $this->default_album_id; $audio_data['album_name'] = $this->default_album_name; } $audio_ids = $new_album->get_contents_for_collection(); if (!empty($audio_ids)) { $k = 0; $ids = array(); for ($i = 0; $i < count($audio_ids); $i++) { if ($audio_ids[$i]['type'] != 7) { // Type 7 is for SB Content $ids[$i] = $audio_ids[$i]['content_id']; } else { $tags = Tag::load_tags_for_content($audio_ids[$i]['content_id']); $tags = show_tags($tags, null); //show_tags function is defined in uihelper.php $sb_audios[] = array('content_id' => $audio_ids[$i]['content_id'], 'title' => $audio_ids[$i]['title'], 'type' => $audio_ids[$i]['type'], 'created' => $audio_ids[$i]['created'], 'tags' => $tags); } } $new_audio = new Audio(); $data = $new_audio->load_many($ids, $this->uid, $login_uid); if (count($data) > 0) { foreach ($data as $d) { $audio_data[$k]['content_id'] = $d['content_id']; $audio_data[$k]['audio_file'] = $d['audio_file']; $audio_data[$k]['audio_caption'] = $d['audio_caption']; $audio_data[$k]['title'] = $d['title']; $audio_data[$k]['body'] = $d['body']; $audio_data[$k]['created'] = $d['created']; $audio_data[$k]['tags'] = $d['tags']; $audio_data[$k]['type'] = ""; $k++; } } // Merging Media Gallery content and SB Content for ($counter = 0; $counter < count($sb_audios); $counter++) { $audio_data[$k]['content_id'] = $sb_audios[$counter]['content_id']; $audio_data[$k]['title'] = $sb_audios[$counter]['title']; $audio_data[$k]['type'] = $sb_audios[$counter]['type']; $audio_data[$k]['image_caption'] = $sb_audios[$counter]['title']; $audio_data[$k]['created'] = $sb_audios[$counter]['created']; $audio_data[$k]['tags'] = $sb_audios[$counter]['tags']; $k++; } } if (!empty($_GET['view'])) { if (empty($frnd_list)) { $audio_data = NULL; } } $inner_template = NULL; switch ($this->mode) { default: $inner_template = dirname(__FILE__) . '/center_inner_public.tpl'; } $obj_inner_template =& new Template($inner_template); $obj_inner_template->set('links', $audio_data); $obj_inner_template->set('uid', $this->uid); $obj_inner_template->set('frnd_list', $frnd_list); $obj_inner_template->set('my_all_album', $this->my_all_album); $obj_inner_template->set('show_view', $this->show_view); $inner_html = $obj_inner_template->fetch(); return $inner_html; } else { parent::set_group_media_gallery(); //------------- Handling the Groups Media gallery ----------- $group = ContentCollection::load_collection((int) $_GET['gid'], $_SESSION['user']['id']); $audio_data = Audio::load_audios_for_collection_id($_GET['gid'], $limit = 0); $audio_data['album_id'] = $group->collection_id; $audio_data['album_name'] = $group->title; $inner_template = NULL; switch ($this->mode) { default: $inner_template = dirname(__FILE__) . '/center_inner_public_groups.tpl'; } $obj_inner_template =& new Template($inner_template); $obj_inner_template->set('links', $audio_data); $obj_inner_template->set('show_view', $this->show_view); $obj_inner_template->set('my_all_groups', $this->group_ids); $inner_html = $obj_inner_template->fetch(); return $inner_html; } }
/** * Implements __construct(). * * @param mixed $url * URL. * @param mixed $identifier * Identifier. */ public function __construct($url, $identifier = NULL) { parent::__construct('music', $url, $identifier); }
<?php include_once $CFG->dirroot . "/lib/classes/" . "application/Audio.Class.php5"; $audioObj = new Audio(); $GeneralObj->getRequestVars(); $section = 'Audio'; $mode = $_REQUEST['mode']; $iAudioCategoryId = $_REQUEST['iAudioCategoryId']; if ($mode == "Update") { $audioObj->select($iAudioId); $audioObj->getAllVar(); } else { $mode = "Add"; } if ($file != '') { $link = "index.php?file=" . $file . "&mode=" . $mode . "&listfile=" . $listfile; } $TOP_HEADER = $mode . ' ' . $section; if ($mode == 'Update') { $TOP_HEADER .= ' [' . $vAudioName . ']'; } ?> <form name="frmadd" method="post" enctype="multipart/form-data" action="index.php?file=m-audioadd_a" onsubmit="return CheckExtension('vAudiopath')"> <input type="hidden" id="mode" name="mode" value="<?php echo $mode; ?> "> <input type="hidden" id="SAMPM" name="SAMPM" value="<?php echo $SAMPM; ?> ">
function render() { $pictures = array(); $audios = array(); $videos = array(); global $base_url, $login_uid; $uid_gal = $this->uid; if (!empty($uid_gal)) { $this->view_all_url = "{$base_url}/media_gallery.php?uid={$uid_gal}"; } if ($this->page == 'homepage') { if (isset($_SESSION['user']['id'])) { $my_id = $_SESSION['user']['id']; $this->uid = $_SESSION['user']['id']; } else { $my_id = 0; } if ($this->uid) { $u_id = $this->uid; } else { $u_id = 0; } $pic = Image::load_recent_media_image(0, $my_id); $aud = Audio::load_recent_media_audio(0, $my_id); $vid = Video::load_recent_media_video(0, $my_id); //even if we got more media, we can display only 6 if (count($pic) < 6) { $max = count($pic); } else { $max = 6; } $pictures = array(); for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } if (count($aud) < 6) { $max = count($aud); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } if (count($vid) < 6) { $max = count($vid); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } } else { if ($this->page == 'grouppage') { $pic = Image::load_images_for_collection_id((int) $this->group_details['collection_id']); $aud = Audio::load_audios_for_collection_id((int) $this->group_details['collection_id']); //$this->links = $audios; $vid = Video::load_videos_for_collection_id((int) $this->group_details['collection_id']); if (count($pic) < 6) { $max = count($pic); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } if (count($aud) < 6) { $max = count($aud); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } if (count($vid) < 6) { $max = count($vid); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } } else { $pic = Image::load_images($this->uid, 10, $login_uid); //$this->links = $pictures; $aud = Audio::load_audio($this->uid, 10, $login_uid); //$this->links = $audios; $vid = Video::load_video($this->uid, 10, $login_uid); if (count($pic) < 6) { $max = count($pic); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } if (count($aud) < 6) { $max = count($aud); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } if (count($vid) < 6) { $max = count($vid); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } } } if (!empty($this->group_details) && (!empty($pictures) || !empty($audios) || !empty($videos))) { $this->view_all_url = "{$base_url}/group_media_gallery.php?gid=" . (int) $this->group_details['collection_id']; } if (!empty($this->group_details)) { $this->gid = $this->group_details['collection_id']; } $gallery = array('images' => $pictures, 'audios' => $audios, 'videos' => $videos); $this->links = $gallery; $this->inner_HTML = $this->generate_inner_html($this->links); if (empty($gallery['images']) && empty($gallery['audios']) && empty($gallery['videos'])) { $this->height = 70; $this->view_all_url = ''; } else { $this->height = 260; } $content = parent::render(); return $content; }
/** * @param array $attributes */ public function loadRelated(array $attributes) { parent::loadRelated($attributes); if (isset($attributes['from'])) { $this->from = User::create($attributes['from']); } if (isset($attributes['chat'])) { $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']); } if (isset($attributes['forward_from'])) { $this->forward_from = User::create($attributes['forward_from']); } if (isset($attributes['forward_from_chat'])) { $this->forward_from_chat = Chat::create($attributes['forward_from_chat']); } if (isset($attributes['reply_to_message'])) { $this->reply_to_message = Message::create($attributes['reply_to_message']); } if (isset($attributes['entities'])) { $this->entities = array_map(function ($entity) { return MessageEntity::create($entity); }, $attributes['entities']); } if (isset($attributes['audio'])) { $this->audio = Audio::create($attributes['audio']); } if (isset($attributes['document'])) { $this->document = Document::create($attributes['document']); } if (isset($attributes['photo'])) { $this->photo = array_map(function ($photo) { return PhotoSize::create($photo); }, $attributes['photo']); } if (isset($attributes['sticker'])) { $this->sticker = Sticker::create($attributes['sticker']); } if (isset($attributes['video'])) { $this->video = Video::create($attributes['video']); } if (isset($attributes['voice'])) { $this->voice = Voice::create($attributes['voice']); } if (isset($attributes['contact'])) { $this->contact = Contact::create($attributes['contact']); } if (isset($attributes['location'])) { $this->location = Location::create($attributes['location']); } if (isset($attributes['venue'])) { $this->venue = Venue::create($attributes['venue']); } if (isset($attributes['new_chat_member'])) { $this->new_chat_member = User::create($attributes['new_chat_member']); } if (isset($attributes['left_chat_member'])) { $this->left_chat_member = new User($attributes['left_chat_member']); } if (isset($attributes['new_chat_photo'])) { $this->new_chat_photo = array_map(function ($photo) { return PhotoSize::create($photo); }, $attributes['new_chat_photo']); } }
<?php namespace PHPVideoToolkit; include_once './includes/bootstrap.php'; try { $audio = new Audio($example_audio_path); $process = $audio->getProcess(); $process->addPreInputCommand('-framerate', '1/5'); $process->addPreInputCommand('-pattern_type', 'glob'); $process->addPreInputCommand('-i', $example_images_dir . '*.jpg'); $process->addCommand('-pix_fmt', 'yuv420p'); $process->addCommand('-shortest', ''); $output_format = new VideoFormat(); $output_format->setVideoFrameRate('1/5')->setVideoDimensions(320, 240)->setAudioCodec('libfdk_aac')->setVideoCodec('mpeg4'); // $process->setProcessTimelimit(1); $process = $audio->save('./output/my_homemade_video.mp4', $output_format, Media::OVERWRITE_EXISTING); echo '<h1>Executed Command</h1>'; Trace::vars($process->getExecutedCommand()); echo '<hr /><h1>FFmpeg Process Messages</h1>'; Trace::vars($process->getMessages()); echo '<hr /><h1>Buffer Output</h1>'; Trace::vars($process->getBuffer(true)); echo '<hr /><h1>Resulting Output</h1>'; Trace::vars($process->getOutput()->getMediaPath()); } catch (FfmpegProcessOutputException $e) { echo '<h1>Error</h1>'; Trace::vars($e); $process = $audio->getProcess(); if ($process->isCompleted()) { echo '<hr /><h2>Executed Command</h2>';
public function __construct() { // Construct any possible parent, parse the configuration meanwhile; parent::__construct(); // Tie in common configuration data; $this->tieInCommonConfiguration(); // Get the confiuration data ... self::$objAudioTable = $this->getConfigKey(new S('audio_table')); self::$objAudioTableFId = $this->getConfigKey(new S('audio_table_field_id')); self::$objAudioTableFFile = $this->getConfigKey(new S('audio_table_field_file')); self::$objAudioTableFArtwork = $this->getConfigKey(new S('audio_table_field_artwork')); self::$objAudioTableFTitle = $this->getConfigKey(new S('audio_table_field_title')); self::$objAudioTableFSEO = $this->getConfigKey(new S('audio_table_field_seo')); self::$objAudioTableFArtist = $this->getConfigKey(new S('audio_table_field_artist')); self::$objAudioTableFAlbum = $this->getConfigKey(new S('audio_table_field_album')); self::$objAudioTableFLyrics = $this->getConfigKey(new S('audio_table_field_lyrics')); self::$objAudioTableFDescription = $this->getConfigKey(new S('audio_table_field_description')); self::$objAudioTableFUploadedDate = $this->getConfigKey(new S('audio_table_field_date_uploaded')); self::$objAudioTableFUploaderId = $this->getConfigKey(new S('audio_table_field_uploader_id')); self::$objAudioTableFCategoryId = $this->getConfigKey(new S('audio_table_field_category_id')); self::$objAudioTableFApproved = $this->getConfigKey(new S('audio_table_field_approved')); self::$objAudioTableFCanComment = $this->getConfigKey(new S('audio_table_field_can_comment')); self::$objAudioTableFViews = $this->getConfigKey(new S('audio_table_field_views')); // Comments ... self::$objCommentsTable = $this->getConfigKey(new S('audio_comments_table')); self::$objCommentsTableFId = $this->getConfigKey(new S('audio_comments_table_id')); self::$objCommentsTableFName = $this->getConfigKey(new S('audio_comments_table_name')); self::$objCommentsTableFEML = $this->getConfigKey(new S('audio_comments_table_email')); self::$objCommentsTableFURL = $this->getConfigKey(new S('audio_comments_table_website')); self::$objCommentsTableFRUId = $this->getConfigKey(new S('audio_comments_table_registered_user_id')); self::$objCommentsTableFComment = $this->getConfigKey(new S('audio_comments_table_comment')); self::$objCommentsTableFApproved = $this->getConfigKey(new S('audio_comments_table_approved')); self::$objCommentsTableFDate = $this->getConfigKey(new S('audio_comments_table_date')); self::$objCommentsTableFAudioFileId = $this->getConfigKey(new S('audio_comments_table_audio_file_id')); // Categories ... self::$objCategoryTable = $this->getConfigKey(new S('audio_category_table')); self::$objCategoryTableFId = $this->getConfigKey(new S('audio_category_table_id')); self::$objCategoryTableFName = $this->getConfigKey(new S('audio_category_table_name')); self::$objCategoryTableFSEO = $this->getConfigKey(new S('audio_category_table_seo')); self::$objCategoryTableFDescription = $this->getConfigKey(new S('audio_category_table_description')); self::$objCategoryTableFDate = $this->getConfigKey(new S('audio_category_table_date')); // Configuration ... self::$objItemsPerPage = $this->getConfigKey(new S('audio_settings_audio_items_per_page')); // Load'em defaults ... ATH, STG and others ... $this->ATH = MOD::activateModule(new FilePath('mod/authentication'), new B(TRUE)); $this->STG = MOD::activateModule(new FilePath('mod/settings'), new B(TRUE)); // DB: Auto-CREATE: $objQueryDB = new FileContent($this->getPathToModule()->toRelativePath() . _S . CFG_DIR . _S . __CLASS__ . SCH_EXTENSION); // Make a FOREACH on each ... foreach (_S($objQueryDB->toString())->fromStringToArray(RA_SCHEMA_HASH_TAG) as $k => $v) { // Make'em ... $this->_Q(_S($v)); } // Get an MPTT Object, build the ROOT, make sure the table is OK; self::$objMPTT = new MPTT(self::$objCategoryTable, MPTT::mpttAddUnique(new S(__CLASS__), new S((string) $_SERVER['REQUEST_TIME']))); // Get some JSS data ... $this->objPathToSkinJSS = $this->getPathToSkinJSS()->toRelativePath(); $this->objPathToSkinCSS = $this->getPathToSkinCSS()->toRelativePath(); // CALL them specific TPL methods, add JSS & CSS to page <head'er ... TPL::manageJSS(new FilePath($this->objPathToSkinJSS . self::AUDIO_PLAYER_JS_PATH), new S(self::AUDIO_PLAYER_JS_STRING)); }
public function get_audio() { return Audio::get_by_id($this->audio_id); }
public function parseAudio($audioObject) { $audio = new Audio(); $audio->setFileId($audioObject->file_id); $audio->setDuration($audioObject->duration); if (property_exists($audioObject, 'performer')) { $audio->setPerformer($audioObject->performer); } if (property_exists($audioObject, 'title')) { $audio->setTitle($audioObject->title); } if (property_exists($audioObject, 'mime_type')) { $audio->setMimeType($audioObject->mime_type); } if (property_exists($audioObject, 'file_size')) { $audio->setFileSize($audioObject->file_size); } return $audio; }
public static function createFromData(\stdClass $data) { $content = new static(); $content->languageCode = $data->language; $content->title = $data->title; $content->summary = $data->summary; $content->description = $data->desc; if (isset($data->news)) { $content->news = $data->news; } if (isset($data->images)) { foreach ($data->images as $imageData) { $content->images[] = Image::createFromData($imageData); } } if (isset($data->audio)) { foreach ($data->audio as $audioData) { $content->audio[] = Audio::createFromData($audioData); } } if (isset($data->video)) { foreach ($data->video as $videoData) { $content->videos[] = Video::createFromData($videoData); } } if (isset($data->children)) { foreach ($data->children as $childData) { $content->children[] = MtgObjectBase::createFromData($childData); } } if (isset($data->collections)) { foreach ($data->collections as $collectionData) { $content->collections[] = MtgObjectBase::createFromData($collectionData); } } if (isset($data->references)) { foreach ($data->references as $referenceData) { $content->references[] = MtgObjectBase::createFromData($referenceData); } } if (isset($data->playback)) { $content->playback = Playback::createFromData($data->playback); } if (isset($data->quiz)) { $content->quiz = Quiz::createFromData($data->quiz); } return $content; }
} else { $uid = $_GET['uid']; } // To Check private or public page // tier_one=public&uid=$_SESSION['user']['id']; if ($_GET['tier_one'] == 'public') { $page_type = 'public'; } else { if ($uid != $_SESSION['user']['id']) { $page_type = 'public'; } } // loading images $pictures = Image::load_images($uid, 10); // loading audio $audios = Audio::load_audio($uid, 10); // loading video $videos = Video::load_video($uid, 10); if ($_SESSION['user']['id']) { $user = new User(); $user->load((int) $uid); } else { header("Location: homepage.php?error=1"); } // accessing page settings data $setting_data = ModuleSetting::load_setting(4, $uid); // user general info $user_data_general = array(); $user_generaldata = User::load_user_profile($uid, (int) $_SESSION['user']['id'], GENERAL); for ($i = 0; $i < count($user_generaldata); $i++) { $name = $user_generaldata[$i]['name'];
function peopleaggregator_getFiles($args) { $user = User::from_auth_token($args['authToken']); $context = $args['context']; $files_out = array(); // When uploading a file, we can use the special 'default album' context: 'user:123:album:default:image' if (preg_match("/^user:\\d+:album:default:[a-z]+\$/", $context)) { // no files - this album doesn't exist yet } else { list($collection_id, $album) = api_validate_album_context($context, $user, "read"); foreach (array(array("audio", Audio::load_audios_for_collection_id($collection_id, 0, "C.created")), array("image", Image::load_images_for_collection_id($collection_id, 0, "C.created")), array("video", Video::load_videos_for_collection_id($collection_id, 0, "C.created"))) as $bits) { list($type, $files) = $bits; if ($files) { foreach ($files as $c) { $filename = $c[$type . '_file']; $file_out = array('id' => "file:" . $c['content_id'], 'created' => $c['created'], 'title' => $c['title'], 'content' => $c['body'], 'type' => $type, 'author' => "user:"******"|^http://|", $filename)) { $file_out['url'] = $filename; } else { $full_path = PA::$upload_path . '/' . $filename; if (file_exists($full_path)) { $file_out['url'] = api_get_url_of_file($filename); if ($type == 'image') { list($file_out['width'], $file_out['height']) = getimagesize($full_path); } } } $files_out[] = $file_out; } } } } return array('success' => TRUE, 'files' => $files_out); }
function render() { $pic = $aud = $vid = NULL; switch ($this->page) { case 'homepage': $pic = Image::load_recent_media_image(0, $this->subject); $aud = Audio::load_recent_media_audio(0, $this->subject); $vid = TekVideo::get_media_recent_tekvideo(0, $this->subject); break; case 'grouppage': $pic = Image::load_images_for_collection_id((int) $this->gid); $aud = Audio::load_audios_for_collection_id((int) $this->gid); $tekvid = TekVideo::get(NULL, array('C.collection_id' => $this->group_details->collection_id)); $vid = objtoarray($tekvid); break; case 'userpage': $pic = Image::load_user_gallery_images($this->uid, 10, PA::$login_uid); $aud = Audio::load_user_gallery_audio($this->uid, 10, PA::$login_uid); if (!empty(PA::$page_uid) || PA::$login_uid != PA::$page_uid) { $condition['M.video_perm'] = !empty($this->friend_list) && in_array(PA::$page_uid, $this->friend_list) ? array(WITH_IN_DEGREE_1, ANYONE) : ANYONE; } $tekvid = TekVideo::get(array('show' => 10, 'page' => 1), array('C.author_id' => $this->uid)); $vid = objtoarray($tekvid); $this->view_all_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid={$this->subject}"; break; } //even if we got more media, we can display only 6 $pictures = array(); $max = count($pic) < 6 ? count($pic) : ($max = 6); for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } $audios = array(); $max = count($aud) < 6 ? count($aud) : ($max = 6); for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } $videos = array(); $max = count($vid) < 6 ? count($vid) : ($max = 6); for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } if (!empty($this->group_details) && (!empty($pictures) || !empty($audios) || !empty($videos))) { $this->view_all_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/view=groups_media&gid=" . (int) $this->group_details->collection_id; } $gallery = array('images' => $pictures, 'audios' => $audios, 'videos' => $videos); $this->links = $gallery; $this->inner_HTML = $this->generate_inner_html($this->links); if (empty($gallery['images']) && empty($gallery['audios']) && empty($gallery['videos'])) { $this->height = 70; $this->view_all_url = ''; } else { $this->height = 260; } $content = parent::render(); return $content; }
public function get_audio() { if (!is_null($this->audioid)) { return Audio::get_by_id($this->audioid); } }
<?php #echo '<pre>'; print_r($_REQUEST); exit; include_once $CFG->dirroot . "/lib/classes/" . "application/Audio.Class.php5"; include_once $CFG->dirroot . "/lib/classes/" . "application/User.Class.php5"; include_once $CFG->dirroot . "/lib/classes/" . "application/Email.Class.php5"; $audioObj = new Audio(); $userObj = new User(); $emailObj = new Email(); //print_r($_REQUEST); exit; $dCreated = date('Y-m-d H:i:s'); $GeneralObj->getRequestVars(); $audioObj->setAllVar(); $_FILES['vAudiopath']['name'] = str_replace(' ', '', $_FILES['vAudiopath']['name']); $_FILES['vVideoPath']['name'] = str_replace(' ', '', $_FILES['vVideoPath']['name']); if ($_SESSION["sess_eType"] == "3") { $iCompanyId = $_SESSION['sess_iCompanyId']; $qs = '&iSGroupId=' . $iSGroupId; } else { if ($_SESSION['sess_eType'] == 'Group Admin') { $iCompanyId = $_SESSION['sess_iCompanyId']; $iSGroupId = $_SESSION['sess_iSGroupId']; $qs = ''; } else { $qs = '&iCompanyId=' . $iCompanyId . '&iSGroupId=' . $iSGroupId; } } if ($mode == "Add") { # echo "<pre>"; print_r($_FILES) ; exit; $redirect_file = "index.php?file=m-audioadd&mode=" . $mode . "&iAudioCategoryId=" . $iAudioCategoryId; $GeneralObj->checkDuplicate('iAudioId', 'Audio', array('vAudioName', 'iAudioCategoryId'), $redirect_file, "Audio Title Already Exists ", $vAudioName, 'AND');
$audio_albums = Album::load_all($uid, AUDIO_ALBUM); $audio_data = array(); $j = 0; foreach ($audio_albums as $albums) { $new_album = new Album(AUDIO_ALBUM); $audio_data[$j]['album_name'] = $albums['description']; $audio_data[$j]['album_id'] = $albums['collection_id']; $new_album->collection_id = $albums['collection_id']; $audio_ids = $new_album->get_contents_for_collection(); if (!empty($audio_ids)) { $k = 0; $ids = array(); for ($i = 0; $i < count($audio_ids); $i++) { $ids[$i] = $audio_ids[$i]['content_id']; } $new_audio = new Audio(); if (!empty($ids)) { $data = $new_audio->load_many($ids); } foreach ($data as $d) { $audio_data[$j]['audio_data'][$k]['content_id'] = $d['content_id']; $audio_data[$j]['audio_data'][$k]['audio_file'] = $d['audio_file']; $audio_data[$j]['audio_data'][$k]['audio_caption'] = $d['audio_caption']; $audio_data[$j]['audio_data'][$k]['title'] = $d['title']; $audio_data[$j]['audio_data'][$k]['body'] = $d['body']; $audio_data[$j]['audio_data'][$k]['created'] = $d['created']; $k++; } } $j++; }
<?php //echo $form->textField($model,'tipousuario'); > echo $form->dropDownList($model, 'idiomaid', CHtml::listData(Idiomas::model()->findAll(), 'id', 'nombre'), array('empty' => 'Seleccione')); ?> <?php echo $form->error($model, 'idiomaid'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'audioid'); ?> <?php //echo $form->textField($model,'tipousuario'); > echo $form->dropDownList($model, 'audioid', CHtml::listData(Audio::model()->findAll(), 'idaudio', 'datos'), array('empty' => 'Seleccione')); ?> <?php echo $form->error($model, 'audioid'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'datos'); ?> <?php echo $form->textField($model, 'datos', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'datos');
<?php if (Session::is_group_user("Music Admin")) { $track_id = (int) $_REQUEST["id"]; $track = Audio::get_by_id($track_id); $md5 = $track->get_md5(); $archive = $track->get_archive(); $dir = $archive->get_localpath(); $folder = $md5[0]; $files = array(0 => ".flac", 1 => ".xml"); $tables = array(0 => 'audioartists', 1 => 'audiocomments', 2 => 'audiodir', 3 => 'audiogroups', 4 => 'audiojinglepkgs', 5 => 'audiokeywords', 6 => 'audioplaylists', 7 => 'audiousers'); $wherepre = "audioid = " . $track_id; $where = pg_escape_string($wherepre); $track_id_escaped = pg_escape_string($track_id); DigiplayDB::delete('audio', "id = " . $track_id_escaped); foreach ($tables as $table) { DigiplayDB::delete($table, $where); } foreach ($files as $file) { $path = $dir . "/" . $folder . "/" . $md5 . $file; $cmd = "rm " . $path; shell_exec($cmd); } if (Errors::occured()) { http_response_code(400); exit(json_encode(array("error" => "Something went wrong. You may have discovered a bug!", "detail" => Errors::report("array")))); Errors::clear(); } else { exit(json_encode(array('response' => 'success', 'id' => 1))); } } else {
public function actionVer($expoferia) { $idioma = Idiomas::model()->find('idioma=:idioma', array(':idioma' => Yii::app()->language)); //**TODAS //id de la exposicion $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.nombre1 =:x'; $criteria->params = array(':x' => $expoferia); $expo_feria = Exposicion::model()->find($criteria); $idexpo = $expo_feria->idexposicion; //**TODAS //datos de la expo/feria if ($idioma->idioma == Yii::app()->params->idiomas['Español']) { //español $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.nombre1 =:x'; $criteria->params = array(':x' => $expoferia); } else { //ingles $criteria = new CDbCriteria(); $criteria->select = 't.*, tra_exposicion.*'; $criteria->together = true; $criteria->join = 'LEFT JOIN tra_exposicion ON tra_exposicion.exposicionid = t.idexposicion'; $criteria->condition = 'tra_exposicion.idiomaid =:id and t.nombre1 =:x'; $criteria->params = array(':x' => $expoferia, ':id' => $idioma->id); } $datos = Exposicion::model()->find($criteria); //**COLECTIVA, INDIVIDUAL //catalogos $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:id'; $criteria->params = array(':id' => $idexpo); $catalogo = Catalogo::model()->findAll($criteria); //**COLECTIVA, FERIA if ($datos->tipo == "COLECTIVA" or $datos->tipo == "FERIA") { //artistas de la expo $criteria = new CDbCriteria(); $criteria->select = 't.*, artista_expo.*'; $criteria->together = true; $criteria->join = 'INNER JOIN artista_expo ON artista_expo.idartista = t.idartista'; $criteria->condition = 'artista_expo.idexposicion =:id'; $criteria->params = array(':id' => $idexpo); $criteria->order = "t.apellido ASC"; $artistas = Artista::model()->findAll($criteria); $obras = array(); if ($artistas) { $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idartista =:idartista'; $criteria->join = 'LEFT JOIN tra_obra ON tra_obra.obraid = t.idobra AND tra_obra.idiomaid=:ididioma'; $criteria->params = array(':idartista' => $artistas[0]->idartista, ':ididioma' => $idioma->id); $obras = Obra::model()->findAll($criteria); } } else { $artistas = "."; if ($idioma->idioma == Yii::app()->params->idiomas['Español']) { //español $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:idexpo'; $criteria->params = array(':idexpo' => $idexpo); } else { //ingles $criteria = new CDbCriteria(); $criteria->select = 't.*, tra_obra.*'; $criteria->together = true; $criteria->join = 'LEFT JOIN tra_obra ON tra_obra.obraid = t.idobra'; $criteria->condition = 't.idexposicion =:idexpo and tra_obra.idiomaid =:ididioma'; $criteria->params = array(':idexpo' => $idexpo, ':ididioma' => $idioma->id); } $obras = Obra::model()->findAll($criteria); } /*$obras[] = array(); foreach ($artistas as $artista => $art) { $criteria = new CDbCriteria; $criteria->select = 't.*'; $criteria->condition = 't.idartista =:idartista'; $criteria->join ='LEFT JOIN tra_obra ON tra_obra.obraid = t.idobra AND tra_obra.idiomaid=:ididioma'; $criteria->params = array(':idartista' => $art->idartista,':ididioma'=> $idioma->id); //$criteria->order = "t.apellido ASC"; $obras[$art->idartista] = Obra::model()->findAll($criteria); }*/ //obras SOLO PARA INDIVIDUAL /* $criteria = new CDbCriteria; $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:id'; $criteria->params = array(':id' => $idexpo); $obras = ExpoObra::model()->findAll($criteria); $criteria = new CDbCriteria; $criteria->select = 't.*, tra_exposicion.*'; $criteria->together = true; $criteria->join ='LEFT JOIN tra_exposicion ON tra_exposicion.exposicionid = t.idexposicion'; $criteria->order = "fecha_inicio DESC"; $criteria->condition = 'tra_exposicion.idiomaid =:id'; $criteria->params = array(':id' => $idioma->id); */ //**TODAS //montaje $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:id'; $criteria->params = array(':id' => $idexpo); $montajes = Montaje::model()->findAll($criteria); //**TODAS //fotos exposicion $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:id'; $criteria->params = array(':id' => $idexpo); $fotosexposicion = Fotosexposicion::model()->findAll($criteria); //**COLECTIVA //Verni-fini $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:id'; $criteria->params = array(':id' => $idexpo); $vernifinis = VerniFini::model()->findAll($criteria); //COLECTIVA-INDIVIDUAL $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:id'; $criteria->params = array(':id' => $idexpo); $conversatoriosfotos = ConversatorioFotos::model()->findAll($criteria); //**COLECTIVA //Audio if ($idioma->idioma == Yii::app()->params->idiomas['Español']) { //español $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:idexpo'; $criteria->params = array(':idexpo' => $idexpo); } else { //ingles $criteria = new CDbCriteria(); $criteria->select = 't.*, tra_audio.*'; $criteria->together = true; $criteria->join = 'LEFT JOIN tra_audio ON tra_audio.audioid = t.idaudio'; $criteria->condition = 't.idexposicion =:idexpo and tra_audio.idiomaid =:ididioma'; $criteria->params = array(':idexpo' => $idexpo, ':ididioma' => $idioma->id); } $audio = Audio::model()->find($criteria); // Conversatorio Audio if ($idioma->idioma == Yii::app()->params->idiomas['Español']) { //español $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:idexpo'; $criteria->params = array(':idexpo' => $idexpo); } else { //ingles $criteria = new CDbCriteria(); $criteria->select = 't.*, tra_conversatorioaudio.*'; $criteria->together = true; $criteria->join = 'LEFT JOIN tra_conversatorioaudio ON tra_conversatorioaudio.conversatorioaudioid = t.idaudio'; $criteria->condition = 't.idexposicion =:idexpo and tra_conversatorioaudio.idiomaid =:ididioma'; $criteria->params = array(':idexpo' => $idexpo, ':ididioma' => $idioma->id); } $conversatorioaudio = Conversatoraudio::model()->find($criteria); //texto curatorial if ($idioma->idioma == Yii::app()->params->idiomas['Español']) { //español $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:idexpo'; $criteria->params = array(':idexpo' => $idexpo); } else { //ingles $criteria = new CDbCriteria(); $criteria->select = 't.*, tra_textocuratorial.*'; $criteria->together = true; $criteria->join = 'LEFT JOIN tra_textocuratorial ON tra_textocuratorial.textocuratorialid = t.idtextocuratorial'; $criteria->condition = 't.idexposicion =:idexpo and tra_textocuratorial.idiomaid =:ididioma'; $criteria->params = array(':idexpo' => $idexpo, ':ididioma' => $idioma->id); } $textocuratorial = Textocuratorial::model()->find($criteria); //**COLECTIVA, INDIVIDUAL //conversatorio $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:idexpo'; $criteria->params = array(':idexpo' => $idexpo); $conversatorios = Conversatorio::model()->findAll($criteria); //**TODAS //prensa if ($idioma->idioma == Yii::app()->params->idiomas['Español']) { //español $criteria = new CDbCriteria(); $criteria->select = 't.*'; $criteria->condition = 't.idexposicion =:idexpo'; $criteria->params = array(':idexpo' => $idexpo); $criteria->order = 'fecha DESC'; } else { $criteria = new CDbCriteria(); $criteria->select = 't.*, tra_prensa.*'; $criteria->together = true; $criteria->join = 'LEFT JOIN tra_prensa ON tra_prensa.prensaid = t.idprensa'; $criteria->condition = 't.idexposicion =:idexpo and tra_prensa.idiomaid =:ididioma'; $criteria->params = array(':idexpo' => $idexpo, ':ididioma' => $idioma->id); $criteria->order = 'fecha DESC'; } $prensas = Prensa::model()->findAll($criteria); $this->render('ver', array('datos' => $datos, 'idioma' => $idioma, 'tipo' => $expo_feria->tipo, 'catalogo' => $catalogo, 'artistas' => $artistas, 'montajes' => $montajes, 'vernifinis' => $vernifinis, 'audio' => $audio, 'conversatorios' => $conversatorios, 'prensas' => $prensas, 'obras' => $obras, 'textocuratorial' => $textocuratorial, 'conversatoriosfotos' => $conversatoriosfotos, 'fotosexposicion' => $fotosexposicion, 'conversatorioaudio' => $conversatorioaudio)); }
private function handlePOST_deleteMedia($request_data) { global $error, $error_msg; // echo "<pre>".print_r($request_data,1)."</pre>"; // deleting media if (!empty($request_data['media_id'])) { $id = $request_data['media_id']; try { if ($request_data['type'] == 'Images') { $new_image = new Image(); $new_image->content_id = $id; $new_image->parent_collection_id = !empty($request_data['gid']) ? $request_data['gid'] : -1; $new_image->delete($id); $success_delete = TRUE; $error_msg = 2004; } if ($request_data['type'] == 'Audios') { $new_image = new Audio(); $new_image->content_id = $id; $new_image->delete($id); $success_delete = TRUE; $error_msg = 2005; } if ($request_data['type'] == 'Videos') { $new_image = new TekVideo(); $new_image->content_id = $id; $new_image->delete_video($id); $success_delete = TRUE; $error_msg = 2006; } } catch (PAException $e) { $error_msg = "{$e->message}"; $error = TRUE; } } }
$j++; } if ($_GET['album_type'] == 'audio') { // loading album's all information $new_album = new Album(AUDIO_ALBUM); $content_data[$j]['album_name'] = $albums['description']; $content_data[$j]['album_id'] = $albums['collection_id']; $content_data[$j]['album_type'] = $_GET['album_type']; $new_album->collection_id = $albums['collection_id']; $image_ids = $new_album->get_contents_for_collection(); if (!empty($image_ids)) { $k = 0; for ($i = 0; $i < count($image_ids); $i++) { $ids[$i] = $image_ids[$i]['content_id']; } $new_image = new Audio(); $data = $new_image->load_many($ids); foreach ($data as $d) { $content_data[$j]['data'][$k]['content_id'] = $d['content_id']; $content_data[$j]['data'][$k]['file'] = $d['audio_file']; $content_data[$j]['data'][$k]['caption'] = $d['audio_caption']; $content_data[$j]['data'][$k]['title'] = $d['title']; $content_data[$j]['data'][$k]['body'] = $d['body']; $content_data[$j]['data'][$k]['created'] = $d['created']; $k++; } } $j++; } if ($_GET['album_type'] == 'video') { $new_album = new Album(VIDEO_ALBUM);
}); Route::get('contacto', function () { $cita = Cita::orderBy('created_at', 'desc')->first(); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('contacto', array('cita' => $cita, 'menu' => $menu)); }); Route::get('bio', function () { $cita = Cita::orderBy('created_at', 'desc')->first(); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('bio', array('cita' => $cita, 'menu' => $menu, 'bio' => DB::table('bio')->orderBy('id', 'desc')->first())); }); Route::get('/', function () { $cita = Cita::orderBy('created_at', 'desc')->first(); $galerias = Galeria::with('imagenes')->where('estado', '=', 'Activa')->orderBy('order')->get(); $video = Video::orderBy('id')->first(); $audio = Audio::orderBy('id')->first(); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('index', array('cita' => $cita, 'galerias' => $galerias, 'menu' => $menu, 'audio' => $audio, 'video' => $video)); }); Route::get('/imagen/{name}/{id}', function ($name, $id) { $cita = Cita::orderBy('created_at', 'desc')->first(); $imagen = Imagen::find($id); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return View::make('imagen', array('cita' => $cita, 'imagen' => $imagen, 'menu' => $menu)); }); Route::get('/video/{name}/{id}', function ($name, $id) { $cita = Cita::orderBy('created_at', 'desc')->first(); $video = Video::find($id); $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get(); return Redirect::to($video->video); });
/** * 插入声音记录 * * @param array $group * @return void */ protected static function insertAudios(array $group) { foreach ($group as $data) { $list = ['qiniu' => $data, 'other' => $data]; if (!empty($data['file_name'])) { $list['qiniu']['src'] = Audio::SOURCE_DEFAULT; $list['qiniu']['url'] = self::getQiniuUrl($data['file_name']); } if (!empty($data['original_url'])) { $list['other']['src'] = $data['url_source']; $list['other']['url'] = $data['original_url']; } else { unset($list['other']); } foreach ($list as $item) { Audio::create(['date' => $item['date'], 'part' => $item['part'], 'title' => $item['topic'], 'source' => $item['src'], 'url' => $item['url'], 'state' => Audio::STATE_ENABLE]); } } }