예제 #1
0
파일: tree.php 프로젝트: rudenyl/kcms
 static function recurse($id, $indent, $list, &$children, $maxlevel = 9999, $level = 0, $type = 1, $compact = false)
 {
     if (@$children[$id] && $level <= $maxlevel) {
         foreach ($children[$id] as $v) {
             $id = $v->id;
             if ($type) {
                 $pre = '';
                 if ($level) {
                     $pre = '<sup>|_</sup>&nbsp;';
                 }
                 $spacer = str_repeat('&nbsp;', 6);
             } else {
                 $pre = '- ';
                 $spacer = '&nbsp;&nbsp;';
             }
             if ($v->parent == 0) {
                 $txt = $v->text;
             } else {
                 $txt = $pre . $v->text;
             }
             $list[$id] = $v;
             if (!$compact) {
                 $list[$id]->text = "{$indent}{$txt}";
                 $list[$id]->level = $level;
                 $list[$id]->children = count(@$children[$id]);
             }
             $list = HTMLHelper::_('tree.recurse', $id, $indent . $spacer, $list, $children, $maxlevel, $level + 1, $type, $compact);
         }
     }
     return $list;
 }
예제 #2
0
파일: editor.php 프로젝트: rudenyl/kcms
    function tinymce($name, $value = '', $required = false, $rows = 10, $cols = 50, $params = null)
    {
        $app =& Factory::getApplication();
        $config =& Factory::getConfig();
        // set script source path
        $baseURL = $config->baseURL;
        $baseURL = str_replace(@$config->admin_path, '', $baseURL);
        $app->set('js', $baseURL . 'assets/editors/tinymce/tiny_mce.js');
        $show_format_1 = isset($params['buttons1_format']) && $params['buttons1_format'] ? true : false;
        $show_buttons_2 = isset($params['buttons2']) && $params['buttons2'] ? true : false;
        ob_start();
        ?>
<script>
tinyMCE.init({
	// General options
	mode : "exact",
	elements : "<?php 
        echo $name;
        ?>
",
	theme : "advanced",
	skin : "o2k7",
	skin_variant : "silver",
	relative_urls : false,
	remove_script_host : false,
	invalid_elements: "script",
	plugins : "safari,table,style,advimage,paste,advlink,inlinepopups,media,directionality",

	// Theme options
	content_css : "<?php 
        echo $baseURL;
        ?>
templates/<?php 
        echo $config->__raw->template;
        ?>
/assets/css/editor.css",
	theme_advanced_buttons1 : "<?php 
        echo $show_format_1 ? 'formatselect,' : '';
        ?>
bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|undo,redo,|,pastetext,pasteword,|,link,unlink,image,|,code",
	theme_advanced_buttons2 : "<?php 
        echo $show_buttons_2 ? 'tablecontrols,|,hr,removeformat' : '';
        ?>
",
	theme_advanced_buttons3 : "<?php 
        echo $show_buttons_2 ? 'formatselect,fontselect,fontsizeselect' : '';
        ?>
",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "none"
	<?php 
        if (isset($params['width'])) {
            ?>
	,width: <?php 
            echo $params['width'];
            ?>
	<?php 
        }
        ?>
	<?php 
        if (isset($params['height'])) {
            ?>
	,height: <?php 
            echo $params['height'];
            ?>
	<?php 
        }
        ?>
	
	// File manager (MFM)
	,file_browser_callback : _loadMFM
});
function _loadMFM(field_name, url, type, win) {
	tinyMCE.activeEditor.windowManager.open({
		<?php 
        // build params for this plugin
        $fm_params = array('base_path' => BASE_PATH, 'root_path' => $baseURL, 'editor_path' => $baseURL . 'assets/editors/tinymce', 'file_root' => 'uploads');
        $fm_params = base64_encode(serialize($fm_params));
        ?>
		file : "<?php 
        echo $baseURL;
        ?>
assets/editors/editor_plugins/mfm.php?field=" + field_name + "&url=" + url + "&params=<?php 
        echo $fm_params;
        ?>
",
		title : 'File Manager',
		width : 640,
		height : 450,
		resizable : "no",
		inline : "yes",
		close_previous : "no"
	}, 
	{
		window : win,
		input : field_name
	});
	
	return false;
}
</script>
<?php 
        $js_script = ob_get_clean();
        $app->set('js', $js_script, false, true);
        $attributes = array('mce_editable="true"');
        // attach script tag
        if (isset($params['attach_script']) && $params['attach_script']) {
            $script_tag = str_replace(array('<script>', '</script>'), array('', ''), $js_script);
            $attributes[] = '_script_tag="' . base64_encode($script_tag) . '"';
        }
        // load generic
        return HTMLHelper::_('editor.generic', $name, $value, $required, $rows, $cols, implode(' ', $attributes));
    }
예제 #3
0
파일: htmlinput.php 프로젝트: rudenyl/kcms
 function select_yesno($name, $value = '', $attr = '', $required = false)
 {
     $options = array();
     $options[] = HTMLHelper::_('htmlinput.option', 'No', 0);
     $options[] = HTMLHelper::_('htmlinput.option', 'Yes', 1);
     return self::select($options, $name, $value, $attr, $required);
 }