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


PHP BlockInstance::render_editing方法代码示例

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


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

示例1: configureblockinstance

 /**
  * Configures a blockinstance
  *
  * @param array $values parameters for this function
  */
 public function configureblockinstance($values)
 {
     require_once get_config('docroot') . 'blocktype/lib.php';
     $bi = new BlockInstance($values['id']);
     // Check if the block_instance belongs to this view
     if ($bi->get('view') != $this->get('id')) {
         throw new AccessDeniedException(get_string('blocknotinview', 'view', $bi->get('id')));
     }
     return $bi->render_editing(true);
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:15,代码来源:view.php

示例2: BlockInstance

$smarty->assign('view', $view->get('id'));
$smarty->assign('groupid', $group);
$smarty->assign('institution', $institution);
$smarty->assign('can_change_layout', !$USER->get_account_preference('addremovecolumns') || $view->get('numcolumns') > 1 && $view->get('numcolumns') < 5);
if (get_config('userscanchooseviewthemes') && $view->is_themeable()) {
    $smarty->assign('viewtheme', $viewtheme);
    $smarty->assign('viewthemes', $allowedthemes);
}
$smarty->assign('viewid', $view->get('id'));
$smarty->assign('viewtitle', $viewtitle);
if ($owner) {
    $smarty->assign('ownerlink', 'user/view.php?id=' . $owner);
} else {
    if ($group) {
        $smarty->assign('ownerlink', 'group/view.php?id=' . $group);
    }
}
$blockid = $view->get_blockinstance_currently_being_configured();
if (!$blockid) {
    $blockid = param_integer('block', 0);
}
if ($blockid) {
    // Configuring a single block
    $bi = new BlockInstance($blockid);
    $smarty->assign('block', $bi->render_editing(true));
} else {
    // The HTML for the columns in the view
    $columns = $view->build_columns(true);
    $smarty->assign('columns', $columns);
}
$smarty->display('view/blocks.tpl');
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:blocks.php

示例3: instance_config_store

 public function instance_config_store(Pieform $form, $values)
 {
     global $SESSION, $USER;
     // Destroy form values we don't care about
     unset($values['sesskey']);
     unset($values['blockinstance']);
     unset($values['action_configureblockinstance_id_' . $this->get('id')]);
     unset($values['blockconfig']);
     unset($values['id']);
     unset($values['change']);
     unset($values['new']);
     if (isset($values['retractable'])) {
         switch ($values['retractable']) {
             case BlockInstance::RETRACTABLE_YES:
                 $values['retractable'] = 1;
                 $values['retractedonload'] = 0;
                 break;
             case BlockInstance::RETRACTABLE_RETRACTED:
                 $values['retractable'] = 1;
                 $values['retractedonload'] = 1;
                 break;
             case BlockInstance::RETRACTABLE_NO:
             default:
                 $values['retractable'] = 0;
                 $values['retractedonload'] = 0;
                 break;
         }
     }
     // make sure that user is allowed to publish artefact. This is to stop
     // hacking of form value to attach other users private data.
     $badattachment = false;
     if (!empty($values['artefactid'])) {
         $badattachment = !$this->verify_attachment_permissions($values['artefactid']);
     }
     if (!empty($values['artefactids'])) {
         $badattachment = !$this->verify_attachment_permissions($values['artefactids']);
     }
     if ($badattachment) {
         $result['message'] = get_string('unrecoverableerror', 'error');
         $form->set_error(null, $result['message']);
         $form->reply(PIEFORM_ERR, $result);
         exit;
     }
     $redirect = '/view/blocks.php?id=' . $this->get('view');
     if (param_boolean('new', false)) {
         $redirect .= '&new=1';
     }
     if ($category = param_alpha('c', '')) {
         $redirect .= '&c=' . $category;
     }
     $result = array('goto' => $redirect);
     if (is_callable(array(generate_class_name('blocktype', $this->get('blocktype')), 'instance_config_save'))) {
         try {
             $values = call_static_method(generate_class_name('blocktype', $this->get('blocktype')), 'instance_config_save', $values, $this);
         } catch (MaharaException $e) {
             $result['message'] = $e instanceof UserException ? $e->getMessage() : get_string('unrecoverableerror', 'error');
             $form->set_error(null, $result['message']);
             $form->reply(PIEFORM_ERR, $result);
         }
     }
     $title = isset($values['title']) ? $values['title'] : '';
     unset($values['title']);
     // A block may return a list of other blocks that need to be
     // redrawn after configuration of this block.
     $torender = !empty($values['_redrawblocks']) && $form->submitted_by_js() ? $values['_redrawblocks'] : array();
     unset($values['_redrawblocks']);
     $this->set('configdata', $values);
     $this->set('title', $title);
     $this->commit();
     try {
         $rendered = $this->render_editing(false, false, $form->submitted_by_js());
     } catch (HTMLPurifier_Exception $e) {
         $message = get_string('blockconfigurationrenderingerror', 'view') . ' ' . $e->getMessage();
         $form->reply(PIEFORM_ERR, array('message' => $message));
     }
     $result = array('error' => false, 'message' => get_string('blockinstanceconfiguredsuccessfully', 'view'), 'data' => $rendered, 'blockid' => $this->get('id'), 'viewid' => $this->get('view'), 'goto' => $redirect);
     // Render all the other blocks in the torender list
     $result['otherblocks'] = array();
     foreach ($torender as $blockid) {
         if ($blockid != $result['blockid']) {
             $otherblock = new BlockInstance($blockid);
             $result['otherblocks'][] = array('blockid' => $blockid, 'data' => $otherblock->render_editing(false, false, true));
         }
     }
     $form->reply(PIEFORM_OK, $result);
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:86,代码来源:lib.php

示例4: configureblockinstance

 /**
  * Configures a blockinstance
  *
  * @param array $values parameters for this function
  */
 public function configureblockinstance($values)
 {
     require_once get_config('docroot') . 'blocktype/lib.php';
     $bi = new BlockInstance($values['id']);
     return $bi->render_editing(true);
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:11,代码来源:view.php


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