本文整理汇总了PHP中Block::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::save方法的具体用法?PHP Block::save怎么用?PHP Block::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdminInterface
/**
* Build and return admin interface
*
* Any module providing an admin interface is required to have this function, which
* returns a string containing the (x)html of it's admin interface.
* @return string
*/
function getAdminInterface()
{
switch (@$_REQUEST['section']) {
case 'toggle':
$block = new Block($_REQUEST['id']);
if ($block->getStatus() == 'active') {
$block->setStatus('inactive');
$block->save();
} else {
$block->setStatus('active');
$block->save();
}
return $this->topLevelAdmin();
break;
case 'addedit':
$block = new Block(@$_REQUEST['blocks_id']);
$form = $block->getAddEditForm();
if ($form->validate() && $form->isSubmitted() && isset($_REQUEST['blocks_submit'])) {
return $this->topLevelAdmin();
} else {
return $block->getAddEditForm()->display();
}
break;
case 'delete':
$block = new Block(@$_REQUEST['blocks_id']);
$block->delete();
return $this->topLevelAdmin();
break;
default:
return $this->topLevelAdmin();
}
}
示例2: addBlock
public static function addBlock($blocker, $to_block)
{
if ($blocker == $to_block) {
// Blocking yourself would be stupid, don't do it.
return;
}
$block = new Block();
$block->blocking_user_id = $blocker;
$block->blocked_user_id = $to_block;
$block->save();
# Take the blocker of the blocked autoread
$q = Doctrine_Query::create()->update("Autofinger")->set("updated", 0)->where("interest = ?", $blocker)->andWhere("owner = ?", $to_block);
$q->execute();
}
示例3: executeCreate
public function executeCreate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST));
$bPost = $request->getParameter('block');
$bData = new BlockData();
$bData->fromArray($bPost['block_data']);
$bPosition = new BlockPosition();
$bPosition->fromArray($bPost['block_position']);
$block = new Block();
$block->set('BlockData', $bData);
$block->set('BlockPosition', $bPosition);
$block->save();
$this->block = $block;
$this->setTemplate('show');
}
示例4: actionCreate
public function actionCreate()
{
$model = new Block();
if (isset($_POST['Block'])) {
$model->setAttributes($_POST['Block']);
try {
if ($model->save()) {
if (isset($_GET['returnUrl'])) {
$this->redirect($_GET['returnUrl']);
} else {
$this->redirect(array('/block'));
}
}
} catch (Exception $e) {
$model->addError('', $e->getMessage());
}
} elseif (isset($_GET['Block'])) {
$model->attributes = $_GET['Block'];
}
$this->render('create', array('model' => $model));
}
示例5: Block
// --------- get in touch
$block = new Block();
$block->setName('Get in Touch');
$block->setContent('
<h3>Get in Touch</h3>
<p>You can contact us by email or phone:<br>
<strong>Phone</strong>: +61 2 9267 6047<br>
<strong>Email</strong>: info@ct21.com.au</p>
<p><strong>Address</strong>: Suite 1003, 370 Pitt St. Sydney, NSW 2000, Australia</p>
<p><strong>Business Hours:</strong><br>
Monday-Friday: 9AM to 5PM<br>
Saturday-Sunday: 9AM to 1PM</p>
');
$block->save();
// ------------ course search
$block = new Block();
$block->setName('Course search');
$block->setContent('
<h2><a href="http://www.globecourse.com/sou.php">Search your course</a></h2>
<p>Search in our advanced course database for the course that suits you the most.</p>
');
$block->save();
// ------------ youtube video
$block = new Block();
$block->setName('Youtube video');
$block->setContent('
<p>https://www.youtube.com/watch?v=jiBxpdobg0E</p>
');
$block->save();
}
示例6: Block
function add_block($parent, $type)
{
$page_path = $_POST['page_path'];
PC::page_paths($page_path);
$this->BuilderEngine->set_page_path($page_path);
//$this->blocks->set_page_path($this->blocks->get_page_path_of($parent));
$max_id = $this->blocks->get_max_block_id();
$new_id = $max_id + 1;
$new_block_name = "custom-block-" . $new_id;
$block = new Block($parent);
$block->load();
$new_block = new Block($new_block_name);
$new_block->set_type($type);
if (isset($_POST['data_class']) && $_POST['data_class'] != "") {
$new_block->add_css_class($_POST['data_class']);
}
if ($block->is_global()) {
$new_block->set_global(true);
}
$block->add_block_first($new_block);
$block->save();
$new_block->set_content("Your new block.");
$new_block->show();
}
示例7: Block
function _integrate_builderengine_styles()
{
?>
<script src="<?php
echo home_url("/builderengine/public/js/jquery.js");
?>
"></script>
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<link href="http://vitalets.github.io/angular-xeditable/dist/css/xeditable.css" rel="stylesheet" />
<link rel='stylesheet' id='font-awesome-4-css' href="<?php
echo base_url('/builderengine/public/css/font-awesome.css?ver=4.0.3');
?>
" type='text/css' media='all' />
<?php
if (is_installed()) {
?>
<?php
$block = new Block('be_body_styler_' . $this->BuilderEngine->get_option('active_frontend_theme'));
$block->set_global(true);
if (!$block->load()) {
$block->save();
}
?>
<style>
body
{
<?php
echo $block->build_style(true);
?>
}
<?php
}
?>
#virtual-block-holder{
position: absolute;
z-index:999;
}
.area {
position: relative;
display: inline-block;
min-width: 50px;
min-height: 25px;
}
#admin-window {
z-index: 999999 !important;
}
.block-children {
/*min-height: 20px;*/
position:relative;
/*display: inline-block;*/
/*float: left;*/
}
.block {
position: relative;
/*float: left;*/
/*display: inline-block;*/
}
.placeholder {
border: 1px dotted #888;
-webkit-box-shadow: 0px 0px 10px #888;
-moz-box-shadow: 0px 0px 10px #888;
box-shadow: 0px 0px 10px #888;
}
.ui-sortable-placeholder {
border: 2px dotted #333;
-webkit-box-shadow: 0px 0px 10px #888;
-moz-box-shadow: 0px 0px 10px #888;
box-shadow: 0px 0px 10px #888;
visibility: visible !important;
}
</style>
<?php
}
示例8: Block
$object = new Block();
// handle form submission
if (isset($_POST['submit'])) {
$error_flag = false;
/// validation
// validation for $content
$content = isset($_POST["content"]) ? $_POST["content"] : null;
if (empty($content)) {
Message::register(new Message(Message::DANGER, i18n(array("en" => "content is required.", "zh" => "请填写content"))));
$error_flag = true;
}
/// proceed submission
// proceed for $content
$object->setContent($content);
if ($error_flag == false) {
if ($object->save()) {
Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
HTML::forwardBackToReferer();
} else {
Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
}
}
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Block', 'zh' => 'Create Content Block'))));
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$html->renderOut('block/backend/block_create', array('object' => $object));
$html->output('</div>');
$html->renderOut('core/backend/html_footer');
exit;
示例9: Block
function add_block($parent, $type)
{
$page_path = $_POST['page_path'];
PC::page_paths($page_path);
$this->BuilderEngine->set_page_path($page_path);
//$this->blocks->set_page_path($this->blocks->get_page_path_of($parent));
$max_id = $this->blocks->get_max_block_id();
$new_id = $max_id + 1;
$new_block_name = "custom-block-" . $new_id;
$block = new Block($parent);
$block->load();
$new_block = new Block($new_block_name);
$new_block->set_type($type);
$block->add_block($new_block);
$block->save();
$new_block->set_content("Your new block.");
$new_block->show();
}
示例10: Block
$block1->force_data_modification();
?>
<?php
$block1->set_data('content', '
<!-- Widget -->
<div class="widget">
<h4>Recent Posts</h4>
<ul>
' . $recent_posts . '
</ul>
</div>', true);
?>
<?php
$block1->save();
?>
<?php
$block2 = new Block('be-module-blog-entry-right-about');
?>
<?php
$block2->set_size('span4');
?>
<?php
$block2->set_default("\n <div class=\"widget\">\n <h4>About</h4>\n <p>Nulla facilisi. Sed justo dui, id erat. Morbi auctor adipiscing tempor. Phasellus condimentum rutrum aliquet. Quisque eu consectetur erat. Proin rutrum, erat eget posuere semper, <em>arcu mauris posuere tortor</em>,velit at <a href=\"#\">magna sollicitudin cursus</a> ac ultrices magna. Aliquam consequat, purus vitae auctor ullamcorper, sem velit convallis quam, a pharetra justo nunc et mauris. </p>\n </div>");
?>
<?php
$right->add_block($block1);
?>
<?php
$right->add_block($block2);