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


PHP myPartnerUtils::shouldForceUniqueKshow方法代码示例

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


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

示例1: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshows_from_db = null;
     // works in one of 2 ways:
     // 1. get no requested name - will create a new kshow and return its details
     // 2. get some name - tries to fetch by name. if already exists - return it
     // get the new properties for the kuser from the request
     $kshow = new kshow();
     $allow_duplicate_names = $this->getP("allow_duplicate_names", true, true);
     if ($allow_duplicate_names === "false" || $allow_duplicate_names === 0) {
         $allow_duplicate_names = false;
     }
     $return_metadata = $this->getP("metadata", false);
     $detailed = $this->getP("detailed", false);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $obj_wrapper = objectWrapperBase::getWrapperClass($kshow, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kshow, "kshow_", $obj_wrapper->getUpdateableFields());
     // check that mandatory fields were set
     // TODO
     $kshow->setName(trim($kshow->getName()));
     // ASSUME - the name is UNIQUE per partner_id !
     if ($kshow->getName()) {
         if (myPartnerUtils::shouldForceUniqueKshow($partner_id, $allow_duplicate_names)) {
             // in this case willsearch for an existing kshow with this name and return with an error if found
             $kshows_from_db = kshowPeer::getKshowsByName(trim($kshow->getName()));
             if ($kshows_from_db) {
                 $kshow_from_db = $kshows_from_db[0];
                 $this->addDebug("already_exists_objects", count($kshows_from_db));
                 $this->addError(APIErrors::DUPLICATE_KSHOW_BY_NAME, $kshow->getName());
                 // This field in unique. Please change ");
                 if (myPartnerUtils::returnDuplicateKshow($partner_id)) {
                     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level));
                 }
                 return;
             }
         }
     }
     // the first kuser to create this kshow will be it's producer
     $producer_id = $puser_kuser->getKuserId();
     $kshow->setProducerId($producer_id);
     // moved to the update - where there is
     $kshow->setPartnerId($partner_id);
     $kshow->setSubpId($subp_id);
     $kshow->setViewPermissions(kshow::KSHOW_PERMISSION_EVERYONE);
     // by default the permissions should be public
     if ($kshow->getPermissions() === null) {
         $kshow->setPermissions(myPrivilegesMgr::PERMISSIONS_PUBLIC);
     }
     // have to save the kshow before creating the default entries
     $kshow->save();
     $show_entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $producer_id, "&auto_edit.jpg", $kshow->getName());
     // roughcut
     $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_VIDEO, $producer_id);
     // intro
     /*
     		$sample_text = $kshow->getName();
     		$host = requestUtils::getHost();
     */
     $sample_text = "";
     myEntryUtils::modifyEntryMetadataWithText($show_entry, $sample_text, "");
     // set the roughcut to false so the update iwll override with better data
     $kshow->setHasRoughcut(false);
     $kshow->initFromTemplate($producer_id, $sample_text);
     $kshow->save();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_ADD, $kshow);
     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow, $level));
     if ($return_metadata) {
         $this->addMsg("metadata", $kshow->getMetadata());
     }
     $this->addDebug("added_fields", $fields_modified);
     if ($kshows_from_db) {
         $this->addDebug("already_exists_objects", count($kshows_from_db));
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:74,代码来源:addkshowAction.class.php

示例2: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     // get the new properties for the kshow from the request
     $kshow_update_data = new kshow();
     $start_obj_creation = microtime(true);
     $kshow = new kshow();
     $obj_wrapper = objectWrapperBase::getWrapperClass($kshow, 0);
     //		$this->addDebug ( "timer_getWrapperClass1" , ( microtime( true ) - $start_obj_creation ) );
     $timer = microtime(true);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kshow, "kshow_", $obj_wrapper->getUpdateableFields());
     //		$this->addDebug ( "timer_fillObjectFromMap" , ( microtime( true ) - $timer ) );
     $kshow->setName(trim($kshow->getName()));
     $kshow_id = $this->getPM("kshow_id");
     $detailed = $this->getP("detailed", false);
     $allow_duplicate_names = $this->getP("allow_duplicate_names", true, true);
     if ($allow_duplicate_names === "false" || $allow_duplicate_names === 0) {
         $allow_duplicate_names = false;
     }
     if (count($fields_modified) > 0) {
         $timer = microtime(true);
         $kshow_from_db = kshowPeer::retrieveByPK($kshow_id);
         if (!$kshow_from_db) {
             // kshow with this id does not exists in the DB
             $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
             return;
         }
         if (!$this->isOwnedBy($kshow_from_db, $puser_kuser->getKuserId())) {
             $this->verifyPrivileges("edit", $kshow_id);
         }
         // user was granted explicit permissions when initiatd the ks
         if (myPartnerUtils::shouldForceUniqueKshow($partner_id, $allow_duplicate_names)) {
             $kshow_with_name_from_db = kshowPeer::getFirstKshowByName($kshow->getName());
             if ($kshow_with_name_from_db && $kshow_with_name_from_db->getId() != $kshow_id) {
                 $this->addError(APIErrors::DUPLICATE_KSHOW_BY_NAME, $kshow->getName());
                 $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
                 if (myPartnerUtils::returnDuplicateKshow($partner_id)) {
                     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level));
                 }
                 return;
             }
         }
         $this->addMsg("old_kshow", objectWrapperBase::getWrapperClass($kshow_from_db->copy(), objectWrapperBase::DETAIL_LEVEL_REGULAR));
         //			$this->addDebug ( "timer_db_retrieve" , ( microtime( true ) - $timer ) );
         $timer = microtime(true);
         // copy relevant fields from $kshow -> $kshow_update_data
         baseObjectUtils::fillObjectFromObject($obj_wrapper->getUpdateableFields(), $kshow, $kshow_from_db, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
         //			$this->addDebug ( "timer_fillObjectFromObject" , ( microtime( true ) - $timer ) );
         $timer = microtime(true);
         // TODO - move to some generic place myKshowUtils / kshow.php
         // TODO - this should be called only for the first time or whenever the user wants to force overriding the sample_text
         $force_sample_text = $this->getP("force_sample_text", false);
         $force_sample_text = false;
         $kuser_id = $puser_kuser->getKuserId();
         /*
         			$sample_text = "This is a collaborative video for 
'" . $kshow_from_db->getIndexedCustomData3() . "'.
Click 'Add to Video' to get started";
         			$kshow_from_db->initFromTemplate ( $kuser_id ,$sample_text );
         */
         // be sure to save the $kshow_from_db and NOT $kshow - this will create a new entry in the DB
         $kshow_from_db->save();
         // update the name of the roughcut too
         $show_entry_id = $kshow_from_db->getShowEntryId();
         $showEntry = entryPeer::retrieveByPK($show_entry_id);
         if ($showEntry) {
             $showEntry->setName($kshow_from_db->getName());
             $showEntry->save();
         }
         // TODO - decide which of the notifications should be called
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_UPDATE_INFO, $kshow_from_db);
         // or
         //myNotificationMgr::createNotification( notification::NOTIFICATION_TYPE_KSHOW_UPDATE_PERMISSIONS , $kshow_from_db );
         //			$this->addDebug ( "timer_db_save" , ( microtime( true ) - $timer ) );
         $end_obj_creation = microtime(true);
         $this->addDebug("obj_creation_time", $end_obj_creation - $start_obj_creation);
     } else {
         $kshow_from_db = $kshow;
         // no fiends to update !
     }
     // see if trying to rollback
     $desired_version = $this->getP("kshow_version");
     if ($desired_version) {
         $result = $kshow_from_db->rollbackVersion($desired_version);
         if (!$result) {
             $this->addError(APIErrors::ERROR_KSHOW_ROLLBACK, $kshow_id, $desired_version);
         }
     }
     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, objectWrapperBase::DETAIL_LEVEL_REGULAR));
     $this->addDebug("modified_fields", $fields_modified);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:92,代码来源:updatekshowAction.class.php


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