*
 * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
 * See also {@link http://sourceforge.net/projects/evocms/}.
 *
 * @copyright (c)2003-2013 by Francois Planque - {@link http://fplanque.com/}.
 *
 * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
 *
 * @package admin
 *
 * @version $Id: _coll_sel_skin.view.php 3328 2013-03-26 11:44:11Z yura $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
global $kind;
echo '<h2>' . sprintf(T_('New %s'), get_collection_kinds($kind)) . ':</h2>';
echo '<h3>' . T_('Pick a skin:') . '</h3>';
$SkinCache =& get_SkinCache();
$SkinCache->load_all();
// TODO: this is like touching private parts :>
foreach ($SkinCache->cache as $Skin) {
    if ($Skin->type != 'normal') {
        // This skin cannot be used here...
        continue;
    }
    $disp_params = array('function' => 'pick', 'select_url' => '?ctrl=collections&amp;action=new-name&amp;kind=' . $kind . '&amp;skin_ID=' . $Skin->ID);
    // Display skinshot:
    Skin::disp_skinshot($Skin->folder, $Skin->name, $disp_params);
}
echo '<div class="clear"></div>';
Example #2
0
 *
 * @package admin
 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
 * @author fplanque: Francois PLANQUE.
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
/**
 * @var Blog
 */
global $edited_Blog;
global $action, $next_action, $blogtemplate, $blog, $tab, $admin_url;
$Form = new Form();
$Form->begin_form('fform');
$Form->add_crumb('collection');
$Form->hidden_ctrl();
$Form->hidden('action', 'update_type');
$Form->hidden('tab', $tab);
$Form->hidden('blog', $blog);
$Form->begin_fieldset(T_('Collection type') . get_manual_link('collection-change-type'));
$collection_kinds = get_collection_kinds();
$radio_options = array();
foreach ($collection_kinds as $kind_value => $kind) {
    $radio_options[] = array($kind_value, $kind['name'], $kind['desc']);
}
$Form->radio('type', $edited_Blog->get('type'), $radio_options, T_('Type'), true);
$Form->checkbox_input('reset', 0, T_('Reset'), array('input_suffix' => ' ' . T_('Reset all parameters as for a new collection.'), 'note' => T_('(Only keep collection name, owner, URL, categories and content).')));
$Form->end_fieldset();
$Form->buttons(array(array('submit', 'submit', T_('Save Changes!'), 'SaveButton')));
$Form->end_form();
 * @copyright (c)2003-2013 by Francois Planque - {@link http://fplanque.com/}
 *
 * {@internal Open Source relicensing agreement:
 * }}
 *
 * @package admin
 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
 * @author fplanque: Francois PLANQUE.
 *
 * @version $Id: _coll_sel_type.view.php 3328 2013-03-26 11:44:11Z yura $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
echo '<h2>' . T_('What kind of blog would you like to create?') . get_manual_link('collection-type') . '</h2>';
echo '<table class="coll_kind">';
if ($blog_kinds = get_collection_kinds()) {
    foreach ($blog_kinds as $kind => $info) {
        echo '<tr>';
        echo '<td class="coll_kind"><h3><a href="?ctrl=collections&amp;action=new-selskin&amp;kind=' . $kind . '">' . $info['name'] . ' &raquo;</a></h3></td>';
        echo '<td>' . $info['desc'] . '<td>';
        echo '</tr>';
    }
} else {
    echo '<tr>';
    echo '<td class="coll_kind"><h3><a href="?ctrl=collections&amp;action=new-selskin&amp;kind=std">' . T_('Standard') . ' &raquo;</a></h3></td>';
    echo '<td>' . T_('A standard blog with the most common features.') . '<td>';
    echo '</tr>';
}
echo '</table>';
echo '<p>' . T_('Your selection here will pre-configure your blog in order to optimize it for a particular use. Nothing is final though. You can change all the settings at any time and any kind of blog can be transformed into any other at any time.') . '</p>';
Example #4
0
 /**
  * Event handler: Defines blog settings by its kind. Use {@link get_collection_kinds()} to return
  * an array of available blog kinds and their names.
  * Define new blog kinds in {@link Plugin::GetCollectionKinds()} method of your plugin.
  *
  * Note: You have to change $params['Blog'] (which gets passed by reference).
  *
  * @param array Associative array of parameters
  *   - 'Blog': created Blog (by reference)
  *   - 'kind': the kind of created blog (by reference)
  */
 function InitCollectionKinds(&$params)
 {
     // Load blog functions
     load_funcs('collections/model/_blog.funcs.php');
     // Get all available blog kinds
     $kinds = get_collection_kinds();
     switch ($params['kind']) {
         case 'std':
             // override standard blog settings
             $params['Blog']->set('name', $kinds[$params['kind']]['name']);
             break;
         case 'test_kind':
             $params['Blog']->set('name', $kinds[$params['kind']]['name']);
             $params['Blog']->set('shortname', 'Test blog');
             break;
     }
 }
 * This file implements the UI view for the skin selection when creating a blog.
 *
 * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
 * See also {@link https://github.com/b2evolution/b2evolution}.
 *
 * @license GNU GPL v2 - {@link http://b2evolution.net/about/gnu-gpl-license}
 *
 * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}.
 *
 * @package admin
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
global $kind, $admin_url, $action, $AdminUI;
$kind_title = get_collection_kinds($kind);
echo action_icon(T_('Abort creating new collection'), 'close', $admin_url . '?ctrl=dashboard', ' ' . sprintf(T_('Abort new "%s" collection'), $kind_title), 3, 3, array('class' => 'action_icon floatright'));
echo '<h2 class="page-title">' . sprintf(T_('New %s'), $kind_title) . ':</h2>';
if ($action == 'new-selskin') {
    // Select an existing skin
    echo '<h3>' . sprintf(T_('Pick an existing skin below: (or <a %s>install a new one now</a>)'), 'href="' . $admin_url . '?ctrl=collections&amp;action=new-installskin&amp;kind=' . $kind . '&amp;skin_type=normal"') . '</h3>';
    $SkinCache =& get_SkinCache();
    $SkinCache->load_all();
    // TODO: this is like touching private parts :>
    foreach ($SkinCache->cache as $Skin) {
        if ($Skin->type != 'normal') {
            // This skin cannot be used here...
            continue;
        }
        $disp_params = array('function' => 'pick', 'select_url' => '?ctrl=collections&amp;action=new-name&amp;kind=' . $kind . '&amp;skin_ID=' . $Skin->ID);
        // Display skinshot:
Example #6
0
     // New collection: Select or Install skin
     // Check permissions:
     $current_User->check_perm('blogs', 'create', true);
     param('kind', 'string', true);
     $AdminUI->append_path_level('new', array('text' => sprintf(T_('New "%s" collection'), get_collection_kinds($kind))));
     break;
 case 'new-name':
     // New collection: Set general parameters
     // Check permissions:
     $current_User->check_perm('blogs', 'create', true);
     $edited_Blog = new Blog(NULL);
     $edited_Blog->set('owner_user_ID', $current_User->ID);
     param('kind', 'string', true);
     $edited_Blog->init_by_kind($kind);
     param('skin_ID', 'integer', true);
     $AdminUI->append_path_level('new', array('text' => sprintf(T_('New %s'), get_collection_kinds($kind))));
     break;
 case 'create':
     // Insert into DB:
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('collection');
     // Check permissions:
     $current_User->check_perm('blogs', 'create', true);
     $edited_Blog = new Blog(NULL);
     $edited_Blog->set('owner_user_ID', $current_User->ID);
     param('kind', 'string', true);
     $edited_Blog->init_by_kind($kind);
     if (!$current_User->check_perm('blog_admin', 'edit', false, $edited_Blog->ID)) {
         // validate the urlname, which was already set by init_by_kind() function
         // It needs to validated, because the user can not set the blog urlname, and every new blog would have the same urlname without validation.
         // When user has edit permission to blog admin part, the urlname will be validated in load_from_request() function.