本文整理汇总了PHP中Layout::Copy方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::Copy方法的具体用法?PHP Layout::Copy怎么用?PHP Layout::Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layout
的用法示例。
在下文中一共展示了Layout::Copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Copy
/**
* Copys a layout
*/
public function Copy()
{
// Check the token
if (!Kit::CheckToken()) {
trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
}
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
$layoutid = Kit::GetParam('layoutid', _POST, _INT);
$layout = Kit::GetParam('layout', _POST, _STRING);
$description = Kit::GetParam('description', _POST, _STRING);
$copyMedia = Kit::GetParam('copyMediaFiles', _POST, _CHECKBOX);
Kit::ClassLoader('Layout');
$layoutObject = new Layout($db);
if (!$layoutObject->Copy($layoutid, $layout, $description, $user->userid, (bool) $copyMedia)) {
trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
}
$response->SetFormSubmitResponse(__('Layout Copied'));
$response->Respond();
}
示例2: LayoutCopy
/**
* Copy Layout
* @return <XiboAPIResponse>
*/
public function LayoutCopy()
{
if (!$this->user->PageAuth('layout')) {
return $this->Error(1, 'Access Denied');
}
Kit::ClassLoader('Layout');
$layout = new Layout();
$layoutId = $this->GetParam('layoutId', _INT);
$name = $this->GetParam('layout', _STRING);
$description = $this->GetParam('description', _STRING);
$copyMedia = $this->GetParam('copyMedia', _INT);
if (!$this->user->LayoutAuth($layoutId)) {
return $this->Error(1, 'Access Denied');
}
// Copy this layout
$layoutObject = new Layout();
if (!($id = $layoutObject->Copy($layoutId, $name, $description, $this->user->userid, $copyMedia))) {
return $this->Error($layoutObject->GetErrorNumber(), $layoutObject->GetErrorMessage());
}
Debug::LogEntry('audit', 'Copied layout with id' . $id);
return $this->Respond($this->ReturnId('layout', $id));
}
示例3: AddTemplate
/**
* Adds a template
* @return
*/
function AddTemplate()
{
// Check the token
if (!Kit::CheckToken()) {
trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
}
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
$template = Kit::GetParam('template', _POST, _STRING);
$tags = Kit::GetParam('tags', _POST, _STRING);
$description = Kit::GetParam('description', _POST, _STRING);
$templateLayoutId = Kit::GetParam('layoutid', _POST, _INT);
// Copy the layout and adjust the values of the new layout
$layoutObject = new Layout();
if (!($layoutId = $layoutObject->Copy($templateLayoutId, $template, $description, $user->userid, true))) {
trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
}
// Tag it
if ($tags != '') {
// Create an array out of the tags
$tagsArray = explode(',', $tags);
$tagsArray[] = 'template';
} else {
$tagsArray = array('template');
}
// Add the tags XML to the layout
$layoutObject->EditTags($layoutId, $tagsArray);
$response->SetFormSubmitResponse('Template Added.');
$response->Respond();
}