本文整理汇总了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()));
}