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


PHP FileMaker::moveFile方法代码示例

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


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

示例1: savetemplate

 public function savetemplate()
 {
     global $varChecker;
     $template = $this->dRep->getTemplate($varChecker->getValue('id'), false);
     if ($varChecker->getValue('name') != '') {
         $name = $varChecker->getValue('name');
     } else {
         throw new DataException('nonatemplateme', array('templatename'));
     }
     if ($varChecker->getValue('folderId') == 0) {
         throw new DataException('noResourceFolder', array('resourcefilefields'));
     }
     $resourceFolder = $this->dRep->getFolder($varChecker->getValue('folderId'));
     if ($resourceFolder->getId() == 'new') {
         throw new DataException('folderNotExist');
     }
     //we have the temporary template created, now we need to make it propper
     $spots = $template->getSpots();
     $postedSpots = $varChecker->getValue('spots');
     $count = 0;
     $newSpots = array();
     foreach ($postedSpots as $index => $postedSpot) {
         $postedSpotArray = explode('-', $postedSpot);
         if (count($postedSpotArray) != 3) {
             throw new DataException('errorSaveSpot');
         }
         $tplSpotId = $postedSpotArray[0];
         $spotId = $postedSpotArray[1];
         $spotName = $postedSpotArray[2];
         if ($spotId == 'new' || $spotId == 0) {
             throw new DataException('allspotsneedtype');
         }
         if (isset($spots[$tplSpotId])) {
             //this spot exists from before - check if it has changed
             $spot = $spots[$tplSpotId];
             if ($spot->getId() != $spotId) {
                 $configs = $spot->getConfigValues();
                 $order = $spot->order();
                 $tplSpotId = $spot->getTplSpotId();
                 $spot = $this->dRep->getSpot($spotId);
                 $spot->setProperties(array('order' => $order, 'tplSpotId' => $tplSpotId, 'configs' => $configs));
             }
         } else {
             $spot = $this->dRep->getSpot(array('spotId' => $spotId));
         }
         $spotName = $spot->getConfigvalue('name');
         if ($spotName !== false) {
             $spot->setConfigvalue($spotName, $spotName);
         }
         $order = array('order' => $index);
         $spot->setProperties($order);
         $newSpots[$tplSpotId] = $spot;
         $count++;
     }
     $vars = array('name' => $name, 'spots' => $newSpots, 'folder' => $resourceFolder);
     if (!is_object($template->getSite())) {
         $vars['site'] = $varChecker->getValue('siteId');
     } else {
         if ($template->getSite()->getId() != $varChecker->getValue('siteId')) {
             $fm = new FileMaker();
             if (!is_dir('cache/templates/' . $varChecker->getValue('siteId'))) {
                 $fm->makeDirectory('cache/templates/' . $varChecker->getValue('siteId'));
             }
             $oldPath = 'cache/templates/' . $template->getSite()->getId() . '/' . $template->getFilename();
             $newPath = 'cache/templates/' . $varChecker->getValue('siteId') . '/' . $template->getFilename();
             $fm->moveFile($oldPath, $newPath);
             $vars['site'] = $varChecker->getValue('siteId');
         }
     }
     $template->setProperties($vars);
     $template = $this->dRep->saveTemplate($template);
     echo json_encode(array('success' => 'tpl_saved', 'id' => $template->getId()));
 }
开发者ID:ruffen,项目名称:Pixcel-CMS,代码行数:73,代码来源:template.controller.php


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