public function test_repeater()
 {
     $strs = array('a' => 'aaaaaaaaaa', '&nbsp;' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', '<br>' => '<br><br><br><br><br><br><br><br><br><br>');
     foreach ($strs as $str => $expect) {
         $this->assertEquals($expect, repeater($str, 10));
     }
 }
Esempio n. 2
0
 function _get_search_cache($search_ca_code, $search_field, $search_text, $spt = FALSE)
 {
     if ($spt) {
         $this->db->where("wr_num between '" . $spt . "' and '" . ($spt + $this->config->item('cf_search_part')) . "'");
     }
     if ($search_ca_code) {
         $code_exp = explode('.', $search_ca_code);
         if (!isset($code_exp[1])) {
             $limit_code = $search_ca_code + 1;
         } else {
             $code_ori = substr($code_exp[1], 0, -3);
             $code_num = substr($code_exp[1], -3) + 1;
             $code_plus = repeater('0', 3 - strlen($code_num)) . $code_num;
             $limit_code = $code_exp[0] . '.' . $code_ori . $code_plus;
         }
         $this->db->where(array('ca_code >=' => $search_ca_code, 'ca_code <' => $limit_code));
     }
     if (!$search_field || !$search_text) {
         return FALSE;
     }
     // 검색어를 구분자로 나눈다. 여기서는 공백
     $s = explode(' ', $search_text);
     // 검색필드를 구분자로 나눈다.
     $field = explode('.', trim($search_field));
     $opt = '';
     $where = ' ( ';
     foreach ($s as $sval) {
         // 검색어
         $search_str = trim($sval);
         if ($search_str == '') {
             continue;
         }
         $opt2 = '';
         $where .= $opt . '(';
         foreach ($field as $fval) {
             // 필드의 수만큼 다중 필드 검색 (필드1+필드2...)
             $where .= $opt2;
             switch ($fval) {
                 case 'mb_id':
                 case 'wr_name':
                     $where .= $this->db->protect_identifiers($fval) . ' = ' . $this->db->escape($search_str);
                     break;
                     // LIKE 보다 INSTR 속도가 빠름 (누가 그래?)
                 // LIKE 보다 INSTR 속도가 빠름 (누가 그래?)
                 default:
                     if (preg_match('/[a-zA-Z]/', $search_str)) {
                         $where .= 'INSTR(LOWER(' . $this->db->protect_identifiers($fval) . '), LOWER(' . $this->db->escape($search_str) . '))';
                     } else {
                         $where .= 'INSTR(' . $this->db->protect_identifiers($fval) . ', ' . $this->db->escape($search_str) . ')';
                     }
                     break;
             }
             $opt2 = ' or ';
         }
         $where .= ')';
         $opt = ' and ';
     }
     $where .= ' ) ';
     $this->db->where($where, null, FALSE);
 }
Esempio n. 3
0
 /**
  * Get search form
  *
  * @subpackage	Helpers
  * @param	int
  * @return 	string
  */
 function form($data = '')
 {
     // Set the default options
     $defaults = array('show_categories' => 'no', 'class' => 'search_form', 'id' => '', 'style' => '');
     $options = $this->_ci->settings->get_params($data['attributes'], $defaults);
     $this->_ci->load->helper('form');
     // Should we load up the categories
     $cats = '';
     if ($options['show_categories'] == 'yes') {
         $this->_ci->load->library('categories/categories_library');
         $cats = $this->_ci->categories_model->get_categories();
         $this->_ci->categories_library->category_tree($cats);
         $cats = $this->_ci->categories_library->get_categories();
         $cat_options['0'] = lang('lang_search_all');
         foreach ($cats as $row) {
             $indent = $row['cat_parent'] != 0 ? repeater('&nbsp;&raquo;&nbsp;', $row['depth']) : '';
             $cat_options[$row['cat_id']] = $indent . $row['cat_name'];
         }
         $cats = form_dropdown('category', $cat_options, 'id="cats" class="category"');
     }
     $attributes = array('class' => $options['class'], 'id' => $options['id'], 'style' => $options['style']);
     $output = form_open('search/do_search', $attributes);
     $output .= str_replace('{kb:cats}', $cats, $data['content']);
     $output .= form_close();
     return $output;
 }
Esempio n. 4
0
 public function _index($id = 0, $fileType = 'i')
 {
     // if (!$this->input->is_ajax_request()) {
     // 	die('Ajax requests only...');
     // }
     //$this->template->set_layout(FALSE);
     $data = new stdClass();
     $data->showSizeSlider = $showSizeSlider;
     $data->showAlignButtons = $showAlignButtons;
     $data->fileType = $fileType;
     $data->folders = $this->file_folders_m->get_folders();
     $data->subfolders = array();
     $data->current_folder = $id && isset($data->folders[$id]) ? $data->folders[$id] : ($data->folders ? current($data->folders) : array());
     // Select the images for the current folder. In the future the selection of the type could become dynamic.
     // For future reference: a => audio, v => video, i => image, d => document, o => other.
     if ($data->current_folder) {
         $data->current_folder->items = $this->file_m->order_by('date_added', 'DESC')->where('type', $fileType)->get_many_by('folder_id', $data->current_folder->id);
         $subfolders = $this->file_folders_m->folder_tree($data->current_folder->id);
         foreach ($subfolders as $subfolder) {
             $data->subfolders[$subfolder->id] = repeater('&raquo; ', $subfolder->depth) . $subfolder->name;
         }
         // Set a default label
         $data->subfolders = $data->subfolders ? array($data->current_folder->id => lang('files.dropdown_root')) + $data->subfolders : array($data->current_folder->id => lang('files.dropdown_no_subfolders'));
     }
     // Array for select
     $data->folders_tree = array();
     foreach ($data->folders as $folder) {
         $data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
     }
     Asset::add_path('imagepicker', IMAGEPICKER_PATH . 'imagepicker/');
     $this->template->set_layout('modal')->append_js('imagepicker::imagepicker.js')->append_css('imagepicker::imagepicker.css')->build('files/admin/index', $data);
 }
Esempio n. 5
0
 /**
  * Generate a category select list
  *
  * @param	string - The field name
  */
 public function ice_category_select($data = array())
 {
     $name = $data['attributes']['name'];
     $this->_ci->load->library('categories/categories_library');
     $this->_ci->load->model('categories/categories_model');
     $cats = $this->_ci->categories_model->get_categories();
     $this->_ci->categories_library->category_tree($cats);
     $cats = $this->_ci->categories_library->get_categories();
     $cat_options['0'] = lang('lang_search_all');
     foreach ($cats as $row) {
         $indent = $row['cat_parent'] != 0 ? repeater('&nbsp;&raquo;&nbsp;', $row['depth']) : '';
         $cat_options[$row['cat_id']] = $indent . $row['cat_name'];
     }
     return form_dropdown($name, $cat_options, '', 'class="category_select"');
 }
Esempio n. 6
0
	public function index($id = 0)
	{
		$data->folders			= $this->file_folders_m->get_folders();
		$data->subfolders		= array();
		$data->current_folder	= $id && isset($data->folders[$id])
								? $data->folders[$id]
								: ($data->folders ? current($data->folders) : array());

		if ($data->current_folder)
		{
			$data->current_folder->items = $this->file_m
				->order_by('date_added', 'DESC')
				->where('type !=', 'i')
				->get_many_by('folder_id', $data->current_folder->id);

			$subfolders = $this->file_folders_m->folder_tree($data->current_folder->id);

			foreach ($subfolders as $subfolder)
			{
				$data->subfolders[$subfolder->id] = repeater('&raquo; ', $subfolder->depth) . $subfolder->name;
			}

			// Set a default label
			$data->subfolders = $data->subfolders
				? array($data->current_folder->id => lang('files.dropdown_root')) + $data->subfolders
				: array($data->current_folder->id => lang('files.dropdown_no_subfolders'));
		}

		// Array for select
		$data->folders_tree = array();
		foreach ($data->folders as $folder)
		{
			$data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
		}

		$data->file_types = array(
			'a' => lang('files.type_a'),
			'v' => lang('files.type_v'),
			'd' => lang('files.type_d'),
			'i' => lang('files.type_i'),
			'o' => lang('files.type_o')
		);

		$this->template
			->title('Files')
			->build('files/index', $data);
	}
Esempio n. 7
0
 /**
  * Constructor
  *
  * Loads dependencies.
  *
  * @access	public
  * @return	void
  */
 public function __construct()
 {
     parent::__construct();
     $this->config->load('files');
     $this->lang->load('files');
     $this->load->models(array('file_m', 'file_folders_m'));
     $this->load->library('form_validation');
     $this->form_validation->set_rules($this->_validation_rules);
     $this->_folders = $this->file_folders_m->get_folders();
     // Get the parent -> childs
     $this->data->folders_tree = array();
     foreach ($this->_folders as $folder) {
         $this->data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
     }
     $this->template->set_partial('shortcuts', 'admin/partials/shortcuts')->set_partial('nav', 'admin/partials/nav', array('file_folders' => $this->_folders, 'current_id' => 0));
     $this->_path = FCPATH . $this->config->item('files_folder');
     $this->_check_dir();
 }
Esempio n. 8
0
	public function index($id = FALSE)
	{
		//list of folders for the sidebar
		$folders = $this->file_folders_m->get_many_by('parent_id', 0);
		
		//for dropdown list
		$sub_folders = $this->file_folders_m->get_folders();

		$active_folder = array();

		if(!empty($folders) and !$id)
		{
			$active_folder = $folders[0];
			$active_folder->items = $this->file_m->get_many_by(array('folder_id' => $active_folder->id, 'type' => 'i'));
		}
		elseif(!empty($folders) and $id)
		{
			$active_folder = $this->file_folders_m->get($id);
			$active_folder->items = $this->file_m->get_many_by(array('folder_id' => $id, 'type' => 'i'));
		}
		
		$folder_options = array();
		
		if(!empty($sub_folders))
		{
			foreach($sub_folders as $row)
			{
				if ($row['name'] != '-') //$id OR $row['parent_id'] > 0)
				{
					$indent = ($row['parent_id'] != 0 && isset($row['depth'])) ? repeater('&nbsp;&raquo;&nbsp;', $row['depth']) : '';
					$folder_options[$row['id']] = $indent.$row['name'];
				}
			}
		}
		
		$this->template
			->set('folders', $folders)
			->set('folder_options', $folder_options)
			->set('active_folder', $active_folder)
			->title('Images')
			->build('image/index');
	}
Esempio n. 9
0
 public function index($id = 0)
 {
     $data->folders = $this->file_folders_m->get_folders();
     $data->subfolders = array();
     $data->current_folder = $id && isset($data->folders[$id]) ? $data->folders[$id] : ($data->folders ? current($data->folders) : array());
     if ($data->current_folder) {
         $data->current_folder->items = $this->file_m->select('files.*, file_folders.location')->join('file_folders', 'file_folders.id = files.folder_id')->order_by('files.date_added', 'DESC')->where('files.type', 'i')->get_many_by('files.folder_id', $data->current_folder->id);
         $subfolders = $this->file_folders_m->folder_tree($data->current_folder->id);
         foreach ($subfolders as $subfolder) {
             $data->subfolders[$subfolder->id] = repeater('&raquo; ', $subfolder->depth) . $subfolder->name;
         }
         // Set a default label
         $data->subfolders = $data->subfolders ? array($data->current_folder->id => lang('files:root')) + $data->subfolders : array($data->current_folder->id => lang('files:no_subfolders'));
     }
     // Array for select
     $data->folders_tree = array();
     foreach ($data->folders as $folder) {
         $data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
     }
     $this->template->title('Images')->append_css('admin/basic_layout.css')->build('image/index', $data);
 }
Esempio n. 10
0
    function album_row($albums, $parent, $lvl)
    {
        ?>
					<?php 
        if (isset($albums[$parent])) {
            foreach ($albums[$parent] as $album) {
                ?>
						<tr>
							<td><?php 
                echo form_checkbox('action_to[]', $album->id);
                ?>
</td>
			        <td><?php 
                echo repeater('-- ', $lvl);
                ?>
 <?php 
                echo $album->title;
                ?>
</td>
			        <td><?php 
                echo $album->num_photos;
                ?>
</td>
			        <td><?php 
                echo date('M d, Y', $album->updated_on);
                ?>
</td>
			        <td><?php 
                echo anchor('photos/' . $album->slug, lang('photo_albums.view_label'), 'target="_blank"') . ' | ' . anchor('admin/photos/manage/' . $album->id, lang('photo_albums.manage_label')) . ' | ' . anchor('admin/photos/edit/' . $album->id, lang('photo_albums.edit_label')) . ' | ' . anchor('admin/photos/delete/' . $album->id, lang('photo_albums.delete_label'), array('class' => 'confirm'));
                ?>
			        </td>
			      </tr>
			      <?php 
                album_row($albums, $album->id, $lvl + 1);
                ?>
			      <?php 
            }
        }
    }
Esempio n. 11
0
 function display_field($data)
 {
     $this->EE->lang->loadfile('lonely_cat');
     $this->EE->load->library('api');
     $this->EE->api->instantiate(array('channel_categories', 'channel_structure'));
     // If there is no category set, fetch the default category if set.
     if (!$data) {
         $data = $this->EE->api_channel_structure->get_channel_info($this->EE->input->get_post('channel_id'))->row('deft_category');
     }
     $options = array();
     $cats = $this->_fetch_categories($data);
     $cat_group = NULL;
     // 		 debug($cats);
     if ($this->settings['hide_none'] == 'no') {
         $options['0'] = $this->EE->lang->line('none');
     }
     foreach ($cats as $val) {
         $indent = $val['5'] != 1 ? repeater(NBS . NBS . NBS, $val['5']) : '';
         $options[$val['3']][$val['0']] = $indent . $val['1'];
     }
     return form_dropdown($this->field_name, $options, $data);
 }
Esempio n. 12
0
    function gallery_row($tree, $parent, $lvl)
    {
        ?>
		<?php 
        if (isset($tree[$parent])) {
            foreach ($tree[$parent] as $gallery) {
                ?>
			<tr>
				<td><input type="checkbox" name="delete[<?php 
                echo $gallery->slug;
                ?>
]" /></td>
                <td><?php 
                echo repeater('-- ', $lvl);
                ?>
 <?php 
                echo $gallery->title;
                ?>
</td>
                <td><?php 
                echo $gallery->num_photos;
                ?>
</td>
                <td><?php 
                echo date('M d, Y', $gallery->updated_on);
                ?>
</td>
                <td><?php 
                echo anchor('galleries/' . $gallery->slug, 'View', 'target="_blank"') . ' | ' . anchor('admin/galleries/manage/' . $gallery->slug, 'Manage') . ' | ' . anchor('admin/galleries/edit/' . $gallery->slug, 'Edit') . ' | ' . anchor('admin/galleries/delete/' . $gallery->slug, 'Delete', array('class' => 'confirm'));
                ?>
                    </td>
                 </tr>
                 <?php 
                gallery_row($tree, $gallery->id, $lvl + 1);
                ?>
            <?php 
            }
        }
    }
Esempio n. 13
0
 function display_field($data)
 {
     $this->EE->lang->loadfile('lonely_cat');
     $this->EE->load->library('api');
     $this->EE->api->instantiate(array('channel_categories', 'channel_structure'));
     $this->channel_id = $this->EE->input->get_post('channel_id');
     // If no category is set, check if one has
     // already been set in the categories array
     if (!$data and isset($this->EE->api_channel_categories->categories)) {
         foreach ($this->EE->api_channel_categories->categories as $cat_id => $cat) {
             if ($cat[4]) {
                 $data = $cat[0];
                 break;
             }
         }
     }
     // If there is no category set, fetch the default category if set.
     if (!$data && $this->channel_id) {
         $data = $this->EE->api_channel_structure->get_channel_info($this->channel_id)->row('deft_category');
     }
     $tmp = array();
     $options = array();
     $cats = $this->_fetch_categories();
     $cat_group = NULL;
     foreach ($cats as $val) {
         $indent = $val['parent_id'] != 1 ? repeater(NBS . NBS . NBS, $val['parent_id']) : '';
         $tmp[$val['cat_group_name']][$val['cat_id']] = $indent . $val['cat_name'];
     }
     $options[''] = $this->EE->lang->line('loncat_none');
     if (count($tmp) === 1) {
         foreach ($tmp[$val['cat_group_name']] as $cat_id => $cat) {
             $options[$cat_id] = $cat;
         }
     } else {
         $options = array_merge($options, $tmp);
     }
     return form_dropdown($this->field_name, $options, $data);
 }
Esempio n. 14
0
 function update()
 {
     if (!IS_MEMBER || !$this->input->post('type')) {
         return FALSE;
     }
     // 게시판 관리자 검증 필요
     // if (!IS_ADMIN) { ... }
     $w = $this->input->post('w');
     $ca_code = str_replace('-', '.', $this->input->post('ca_code'));
     if ($this->input->post('ca_name')) {
         $ca_name = $this->input->post('ca_name');
     }
     if ($w == '') {
         $this->Categoryform_model->insert($ca_code, $ca_name);
     } else {
         if ($w == 'u') {
             $this->Categoryform_model->update($ca_code, $ca_name);
         } else {
             if ($w == 'd') {
                 $code_exp = explode('.', $ca_code);
                 if (!isset($code_exp[1])) {
                     $limit_code = $ca_code + 1;
                 } else {
                     $code_ori = substr($code_exp[1], 0, -3);
                     $code_num = substr($code_exp[1], -3) + 1;
                     $code_plus = repeater('0', 3 - strlen($code_num)) . $code_num;
                     $limit_code = $code_exp[0] . '.' . $code_ori . $code_plus;
                 }
                 $this->Categoryform_model->delete($ca_code, $limit_code);
             } else {
                 exit('Access Error');
             }
         }
     }
     echo 'TRUE';
 }
Esempio n. 15
0
	/**
	 * Show the folders contents
	 */
	public function contents($id = 0, $filter = '')
	{
		if ($id)
		{
			$folder = $this->file_folders_m->get($id);
		}
		elseif ($path = $this->input->get('path'))
		{
			$folder = $this->file_folders_m->get_by_path($path);
			$filter = $this->input->get('filter');
		}

		if ( ! (isset($folder) && $folder))
		{
			if ($this->input->is_ajax_request())
			{
				$status		= 'error';
				$message	= lang('file_folders.not_exists');

				$data = array();
				$data['messages'][$status] = $message;
				$message = $this->load->view('admin/partials/notices', $data, TRUE);

				return $this->template->build_json(array(
					'status'	=> $status,
					'message'	=> $message
				));
			}

			show_error(lang('file_folders.not_exists'));
			return;
		}
		elseif ( ! isset($folder->root_id))
		{
			$folder->root_id		= $this->_folders[$folder->id]->root_id;
			$folder->virtual_path	= $this->_folders[$folder->id]->virtual_path;
		}

		$this->load->library('table');

		// Make a breadcrumb trail
		$this->data->crumbs = $this->file_folders_m->breadcrumb($folder->id);

		// Get a list of all child folders
		$sub_folders = $this->file_folders_m->folder_tree($folder->root_id);

		// Array for select
		$this->data->sub_folders = array();
		foreach ($sub_folders as $sub_folder)
		{
			$this->data->sub_folders[$sub_folder->virtual_path] = repeater('&raquo; ', $sub_folder->depth) . $sub_folder->name;
		}

		$root_folder = $this->_folders[$folder->root_id];

		// Set a default label
		$this->data->sub_folders = $this->data->sub_folders
			? array($root_folder->virtual_path => lang('files.dropdown_root')) + $this->data->sub_folders
			: array($root_folder->virtual_path => lang('files.dropdown_no_subfolders'));

		// Get the selected information.
		$this->data->folder				= $folder;
		$this->data->selected_filter	= $filter;

		// Avaliable type filters
		$this->data->types = array();

		$this->db
			->select('type as letter')
			->group_by('type');

		$types = $this->file_m->get_many_by('folder_id', $folder->id);

		foreach ($types as $type)
		{
			$this->data->types[$type->letter] = lang('files.type_' . $type->letter);
		}

		asort($this->data->types);

		// Get all files
		in_array($filter, array('a', 'v', 'd', 'i', 'o')) && $this->db->where('type', $filter);

		$this->data->files = $this->file_m
			->order_by('date_added', 'DESC')
			->get_many_by('folder_id', $folder->id);

		// Response ajax
		if ($this->input->is_ajax_request())
		{
			$content	= $this->load->view('admin/folders/contents', $this->data, TRUE);
			$navigation	= $this->load->view('admin/partials/nav', array(
				'file_folders'	=> $this->_folders,
				'current_id'	=> $folder->root_id
			), TRUE);

			return $this->template->build_json(array(
				'status'	=> 'success',
				'content'	=> $content,
				'navigation'=> $navigation,
			));
		}

		$this->template
			->title($this->module_details['name'], $folder->name)
			->append_metadata( css('files.css', 'files') )
			->build('admin/folders/contents', $this->data);
	}
Esempio n. 16
0
	<h3><?php 
echo lang('files.folders.manage_title');
?>
</h3>

		<?php 
if (!empty($file_folders)) {
    ?>

			<?php 
    $tmpl = array('table_open' => '<table border="0" class="table-list">');
    $this->table->set_template($tmpl);
    $this->table->set_heading(form_checkbox(array('name' => 'action_to_all', 'class' => 'check-all')), lang('files.folders.name'), lang('files.folders.created'), '<span>' . lang('files.labels.action') . '</span>');
    foreach ($file_folders as $folder) {
        $spcr = '&nbsp;&nbsp; &raquo; ';
        $indent = $folder['parent_id'] != 0 ? repeater($spcr, $folder['depth']) : '';
        $edit = anchor('admin/files/folders/edit/' . $folder['id'], lang('files.labels.edit'), 'class="edit_folder"');
        $delete = anchor('admin/files/folders/delete/' . $folder['id'], lang('files.labels.delete'), array('class' => 'confirm'));
        $this->table->add_row(form_checkbox('action_to[]', $folder['id']), $indent . $folder['name'], date("d/m/Y \\a\\t g.i a", $folder['date_added']), $edit . ' | ' . $delete);
    }
    echo $this->table->generate();
    ?>

			<?php 
    $this->load->view('admin/partials/buttons', array('buttons' => array('delete')));
    ?>

		<?php 
} else {
    ?>
			<p>
$data = array();
$saler_name = array();
foreach ($statistics as $statistic) {
    $saler_name = $CI->purchase_statistics_model->fetch_saler_name_by_id($statistic->saler_id);
    $data[] = array($statistic->second_glance_amount, $statistic->totable_amount, $statistic->second_glance_rate, $saler_name);
}
echo block_header(lang('second_glance_rate_statistic'));
$start_year = 2004;
$end_year = date('Y');
$years = array();
for ($i = $start_year; $i <= $end_year; $i++) {
    $years[$i] = $i;
}
$months = array();
for ($i = 1; $i <= 12; $i++) {
    $months[$i] = $i;
}
echo $this->block->generate_pagination('statistics');
echo form_open(current_url());
echo br();
echo form_label(lang('year')) . ': ' . form_dropdown('year', $years, $year);
echo repeater('&nbsp;', 3);
echo form_label(lang('month')) . ': ' . form_dropdown('month', $months, $month);
echo repeater('&nbsp;', 3);
$config = array('name' => 'submit', 'value' => lang('submit'), 'type' => 'submit');
echo block_button($config);
echo form_close();
$sortable = array('default', 'integer', 'default', 'float');
echo block_js_sortable_table($head, $data, $sortable);
echo br();
echo block_notice_div(lang('note') . ': ' . br() . lang('second_glance_rate_monthly_notice'));
Esempio n. 18
0
 private function _make_tree($parent_catalogs)
 {
     $tree = array();
     $names = array();
     foreach ($parent_catalogs as $cat) {
         $path = $cat->path;
         $names[$cat->id] = $cat->name;
         $items = explode('>', $path);
         $item_names = array();
         $space_counter = 0;
         foreach ($items as $item) {
             $name = str_replace('制度', '', element($item, $names));
             $tree[$item] = repeater('&nbsp;&nbsp;', $space_counter) . $name;
             $space_counter++;
         }
         //flat_to_multi($item_names, $tree);
     }
     return $tree;
 }
Esempio n. 19
0
	<li>
		<?php 
    echo form_label(lang('files.description'), 'description');
    ?>
		<?php 
    echo form_textarea(array('name' => 'description', 'id' => 'description', 'value' => set_value('description', $file->description), 'rows' => '4', 'cols' => '30', 'class' => 'crud'));
    ?>
	</li>
	<li>
		<?php 
    echo form_label(lang('files.folder.label') . ':', 'folder_id');
    ?>
		<?php 
    $folder_options['0'] = lang('files.dropdown.no_subfolders');
    foreach ($folders as $row) {
        $indent = $row['parent_id'] != 0 ? repeater('&nbsp;&raquo;&nbsp;', $row['depth']) : '';
        $folder_options[$row['id']] = $indent . $row['name'];
    }
    echo form_dropdown('folder_id', $folder_options, $file->folder_id, 'id="folder_id" class="crud"');
    ?>
	</li>
	<li>
		<?php 
    echo form_label(lang('files.type'), 'type');
    ?>
		<?php 
    echo form_dropdown('type', $types, $file->type, 'id="type" class="crud"');
    ?>
	</li>
	<li>
		<label for="nothing"><?php 
Esempio n. 20
0
// available in the right_nav, but the loaded content is entirely
// contained inside of "pageContents", this the right_nav needs
// to be available in here if its called from the publish page.
if ($this->input->get('modal') == 'yes') {
    $this->load->view('_shared/right_nav');
}
$this->table->set_heading('ID', lang('order'), lang('category_name'), lang('category_url_title'), $can_edit ? lang('edit') : FALSE, $can_delete ? lang('delete') : FALSE);
if (count($categories) > 0) {
    $up = '<img src="' . PATH_CP_GBL_IMG . 'arrow_up.gif" border="0"  width="16" height="16" alt="" title="" />';
    $down = '<img src="' . PATH_CP_GBL_IMG . 'arrow_down.gif" border="0"  width="16" height="16" alt="" title="" />';
    foreach ($categories as $category) {
        $link = '<a href="' . BASE . AMP . 'C=admin_content' . AMP . 'M=change_category_order' . AMP . 'cat_id=' . $category['0'] . AMP . 'group_id=' . $group_id . AMP . 'order=up" class="edit_cat_order_trigger">' . $up . '</a>' . NBS;
        $link .= '<a href="' . BASE . AMP . 'C=admin_content' . AMP . 'M=change_category_order' . AMP . 'cat_id=' . $category['0'] . AMP . 'group_id=' . $group_id . AMP . 'order=down" class="edit_cat_order_trigger">' . $down . '</a>';
        $spcr = '<img src="' . PATH_CP_GBL_IMG . 'clear.gif" border="0"  width="24" height="14" alt="" title="" />';
        $cat_marker = '<img src="' . PATH_CP_GBL_IMG . 'cat_marker.gif" border="0"  width="18" height="14" alt="" title="" />';
        $indent = $category['5'] != 1 ? repeater($spcr, $category['5']) . $cat_marker : '';
        $this->table->add_row($category['0'], $link, $indent . $category['1'], isset($category[9]) ? $category[9] : '', $can_edit ? '<a href="' . BASE . AMP . 'C=admin_content' . AMP . 'M=category_edit' . AMP . 'cat_id=' . $category['0'] . AMP . 'group_id=' . $group_id . '">' . lang('edit') . '</a>' : NULL, $can_delete ? '<a href="' . BASE . AMP . 'C=admin_content' . AMP . 'M=category_delete_conf' . AMP . 'cat_id=' . $category['0'] . AMP . 'group_id=' . $group_id . '">' . lang('delete') . '</a>' : NULL);
    }
} else {
    $this->table->add_row(array('data' => lang('no_category_message'), 'colspan' => 5));
}
echo $this->table->generate();
?>
		
<?php 
if (count($categories) > 0) {
    ?>

	<?php 
    echo form_open($form_action);
    ?>
Esempio n. 21
0
    if ($qty_count > 1) {
        $star_mark = '★';
    } else {
        $packing = get_product_packing_material($order->sku_str);
        if ($packing) {
            $packing_metirial = "{$packing->name_en}";
        }
        $weight = $CI->product_model->fetch_product_total_weight_by_sku($order->sku_str);
        $gift = lang('mouse_pad_gift');
        if ($weight > 0) {
            if (strpos($order->descript, $gift) !== FALSE) {
                $weight += 22;
            }
            $packing_metirial .= "&nbsp;&nbsp;" . $weight . "g";
        } else {
            $packing_metirial .= repeater('&nbsp;', 7);
        }
    }
    $stock_user = '******' . ($priority > 1 ? element($order->stock_user_id, $all_stock_users) : element($current_user_id, $all_stock_users));
    $packing_metirial_str = "<span style='border-bottom: 1px solid black;font-size: 13px;'>{$packing_metirial}</span>{$stock_user}";
    $page = '';
    if ($i % 10 == 0) {
        $p_start = '';
        if ($i != 0) {
            $p_start = '<p style="page-break-before: always;">';
        }
        $html .= <<<HTML
{$p_start}
<table cellspacing="0" cellpadding="2" border="1" align="center" class="label">
    <tbody>
HTML;
Esempio n. 22
0
 private function _make_tree($parent_catalogs)
 {
     $tree = array("-1" => lang('please_select'));
     $names = array();
     foreach ($parent_catalogs as $cat) {
         $path = $cat->path;
         $names[$cat->id] = $cat->name;
         $items = explode('>', $path);
         $item_names = array();
         $space_counter = 0;
         foreach ($items as $item) {
             $tree[$item] = repeater('&nbsp;&nbsp;', $space_counter) . element($item, $names);
             $space_counter++;
         }
     }
     return $tree;
 }
Esempio n. 23
0
 /**
  * Builds the Page Tree into HTML
  * 
  * @param array $links      Page Tree array from `navigation_m->get_link_tree`
  * @param bool  $return_arr Return as an Array instead of HTML
  * @return array|string
  */
 private function _build_links($links = array(), $return_arr = true)
 {
     static $current_link = false;
     static $level = 0;
     $top = $this->attribute('top', false);
     $separator = $this->attribute('separator', '');
     $link_class = $this->attribute('link_class', '');
     $more_class = $this->attribute('more_class', 'has_children');
     $current_class = $this->attribute('class', 'current');
     $first_class = $this->attribute('first_class', 'first');
     $last_class = $this->attribute('last_class', 'last');
     $parent_class = $this->attribute('parent_class', 'parent');
     $dropdown_class = $this->attribute('dropdown_class', 'dropdown');
     $output = $return_arr ? array() : '';
     $wrap = $this->attribute('wrap');
     $max_depth = $this->attribute('max_depth');
     $i = 1;
     $total = sizeof($links);
     if (!$return_arr) {
         $tag = $this->attribute('tag', 'li');
         $list_tag = $this->attribute('list_tag', 'ul');
         switch ($this->attribute('indent')) {
             case 't':
             case 'tab':
             case '	':
                 $indent = "\t";
                 break;
             case 's':
             case 'space':
             case ' ':
                 $indent = "    ";
                 break;
             default:
                 $indent = false;
                 break;
         }
         if ($indent) {
             $ident_a = repeater($indent, $level);
             $ident_b = $ident_a . $indent;
             $ident_c = $ident_b . $indent;
         }
     }
     foreach ($links as $link) {
         $item = array();
         $wrapper = array();
         // attributes of anchor
         $item['url'] = $link['url'];
         $item['title'] = $link['title'];
         $item['total'] = $total;
         if ($wrap) {
             $item['title'] = '<' . $wrap . '>' . $item['title'] . '</' . $wrap . '>';
         }
         $item['attributes']['target'] = $link['target'] ? 'target="' . $link['target'] . '"' : null;
         $item['attributes']['class'] = $link_class ? 'class="' . $link_class . '"' : '';
         // attributes of anchor wrapper
         $wrapper['class'] = $link['class'] ? explode(' ', $link['class']) : array();
         $wrapper['children'] = $return_arr ? array() : null;
         $wrapper['separator'] = $separator;
         // is single ?
         if ($total === 1) {
             $wrapper['class'][] = 'single';
         } elseif ($i === 1) {
             $wrapper['class'][] = $first_class;
         } elseif ($i === $total) {
             $wrapper['class'][] = $last_class;
             $wrapper['separator'] = '';
         }
         // has children ? build children
         if ($link['children']) {
             ++$level;
             if (!$max_depth or $level < $max_depth) {
                 $wrapper['class'][] = $more_class;
                 $wrapper['children'] = $this->_build_links($link['children'], $return_arr);
             }
             --$level;
         }
         // is this the link to the page that we're on?
         if (preg_match('@^' . current_url() . '/?$@', $link['url']) or $link['link_type'] == 'page' and $link['is_home'] and site_url() == current_url()) {
             $current_link = $link['url'];
             $wrapper['class'][] = $current_class;
         }
         // Is this page a parent of the current page?
         // Get the URI and compare
         $uri_segments = explode('/', str_replace(site_url(), '', $link['url']));
         foreach ($uri_segments as $k => $seg) {
             if (!$seg) {
                 unset($uri_segments[$k]);
             }
         }
         $short_segments = array_slice($this->uri->segment_array(), 0, count($uri_segments));
         if (!array_diff($short_segments, $uri_segments)) {
             $wrapper['class'][] = $parent_class;
         }
         // is the link we're currently working with found inside the children html?
         if (!in_array($current_class, $wrapper['class']) and isset($wrapper['children']) and $current_link and (is_array($wrapper['children']) and in_array_r($current_link, $wrapper['children']) or is_string($wrapper['children']) and strpos($wrapper['children'], $current_link))) {
             // that means that this link is a parent
             $wrapper['class'][] = 'has_' . $current_class;
         } elseif ($link['module_name'] === $this->module and !preg_match('@^' . current_url() . '/?$@', $link['url'])) {
             $wrapper['class'][] = 'has_' . $current_class;
         }
         ++$i;
         if ($return_arr) {
             $item['target'] =& $item['attributes']['target'];
             $item['class'] =& $item['attributes']['class'];
             $item['children'] = $wrapper['children'];
             if ($wrapper['class'] && $item['class']) {
                 $item['class'] = implode(' ', $wrapper['class']) . ' ' . substr($item['class'], 7, -1);
             } elseif ($wrapper['class']) {
                 $item['class'] = implode(' ', $wrapper['class']);
             }
             if ($item['target']) {
                 $item['target'] = substr($item['target'], 8, -1);
             }
             // assign attributes to level family
             $output[] = $item;
         } else {
             $add_first_tag = $level === 0 && !in_array($this->attribute('items_only', 'true'), array('1', 'y', 'yes', 'true'));
             // render and indent or only render inline?
             if ($indent) {
                 // remove all empty values so we don't have an empty class attribute
                 $classes = implode(' ', array_filter($wrapper['class']));
                 $output .= $add_first_tag ? "<{$list_tag}>" . PHP_EOL : '';
                 $output .= $ident_b . '<' . $tag . ($classes > '' ? ' class="' . $classes . '">' : '>') . PHP_EOL;
                 $output .= $ident_c . (($level == 0 and $top == 'text' and $wrapper['children']) ? $item['title'] : anchor($item['url'], $item['title'], trim(implode(' ', $item['attributes'])))) . PHP_EOL;
                 if ($wrapper['children']) {
                     $output .= $ident_c . "<{$list_tag}>" . PHP_EOL;
                     $output .= $ident_c . $indent . str_replace(PHP_EOL, PHP_EOL . $indent, trim($ident_c . $wrapper['children'])) . PHP_EOL;
                     $output .= $ident_c . "</{$list_tag}>" . PHP_EOL;
                 }
                 $output .= $wrapper['separator'] ? $ident_c . $wrapper['separator'] . PHP_EOL : '';
                 $output .= $ident_b . "</{$tag}>" . PHP_EOL;
                 $output .= $add_first_tag ? $ident_a . "</{$list_tag}>" . PHP_EOL : '';
             } else {
                 // remove all empty values so we don't have an empty class attribute
                 $classes = implode(' ', array_filter($wrapper['class']));
                 $output .= $add_first_tag ? "<{$list_tag}>" : '';
                 $output .= '<' . $tag . ($classes > '' ? ' class="' . $classes . '">' : '>');
                 $output .= ($level == 0 and $top == 'text' and $wrapper['children']) ? $item['title'] : anchor($item['url'], $item['title'], trim(implode(' ', $item['attributes'])));
                 if ($wrapper['children']) {
                     $output .= '<' . $list_tag . ' class="' . $dropdown_class . '">';
                     $output .= $wrapper['children'];
                     $output .= "</{$list_tag}>";
                 }
                 $output .= $wrapper['separator'];
                 $output .= "</{$tag}>";
                 $output .= $add_first_tag ? "</{$list_tag}>" : '';
             }
         }
     }
     return $output;
 }
$right_side = '<p id="select_block" style="display: ' . $select_js . '">' . form_label(lang('pull_down_items'), 'm_field_list_items') . '<br />' . form_textarea(array('id' => 'm_field_list_items', 'name' => 'm_field_list_items', 'cols' => 90, 'rows' => 10, 'class' => 'field', 'value' => set_value('m_field_list_items', $m_field_list_items))) . '</p>';
// Text Block
$right_side .= '<p id="text_block" style="display: ' . $text_js . ';">' . lang('m_max_length', 'm_field_maxl') . '<br />' . form_input('m_field_maxl', set_value('m_field_maxl', $m_field_maxl), 'class="field" id="m_field_maxl"') . '</p>';
// Textarea Block
$right_side .= '<p id="textarea_block" style="display: ' . $textarea_js . ';">' . lang('text_area_rows', 'm_field_ta_rows') . '<br />' . form_input(array('id' => 'm_field_ta_rows', 'name' => 'm_field_ta_rows', 'class' => 'field', 'value' => set_value('m_field_ta_rows', $m_field_ta_rows))) . '</p>';
$this->table->add_row(array($left_side, $right_side));
// Text Formatting
$this->table->add_row(array(lang('field_format', 'm_field_fmt') . '<br />' . lang('text_area_rows_cont'), form_dropdown('m_field_fmt', $m_field_fmt_options, set_value('m_field_fmt', $m_field_fmt))));
// Required Field?
$this->table->add_row(array(lang('is_field_required', 'm_field_required'), form_radio(array('name' => 'm_field_required', 'id' => 'm_field_required_y', 'value' => 'y', 'checked' => $m_field_required == 'y' ? TRUE : FALSE)) . NBS . lang('yes', 'm_field_required_y') . repeater(NBS, 5) . form_radio(array('name' => 'm_field_required', 'id' => 'm_field_required_n', 'value' => 'n', 'checked' => $m_field_required == 'y' ? FALSE : TRUE)) . NBS . lang('no', 'm_field_required_n')));
// Visible in Public Profiles?
$this->table->add_row(array(lang('is_field_public', 'm_field_public') . '<br />' . lang('is_field_public_cont'), form_radio(array('name' => 'm_field_public', 'id' => 'm_field_public_y', 'value' => 'y', 'checked' => $m_field_public == 'y' ? TRUE : FALSE)) . NBS . lang('yes', 'm_field_public_y') . repeater(NBS, 5) . form_radio(array('name' => 'm_field_public', 'id' => 'm_field_public_n', 'value' => 'n', 'checked' => $m_field_public == 'y' ? FALSE : TRUE)) . NBS . lang('no', 'm_field_public_n')));
// Visible in Registration Page?
$this->table->add_row(array(lang('is_field_reg', 'm_field_reg'), form_radio(array('name' => 'm_field_reg', 'id' => 'm_field_reg_y', 'value' => 'y', 'checked' => $m_field_reg == 'y' ? TRUE : FALSE)) . NBS . lang('yes', 'm_field_reg_y') . repeater(NBS, 5) . form_radio(array('name' => 'm_field_reg', 'id' => 'm_field_reg_n', 'value' => 'n', 'checked' => $m_field_reg == 'y' ? FALSE : TRUE)) . NBS . lang('no', 'm_field_reg_n')));
// Visible in Control Panel Registration Page?
$this->table->add_row(array(lang('is_field_cp_reg', 'm_field_cp_reg'), form_radio(array('name' => 'm_field_cp_reg', 'id' => 'm_field_cp_reg_y', 'value' => 'y', 'checked' => $m_field_cp_reg == 'y' ? TRUE : FALSE)) . NBS . lang('yes', 'm_field_cp_reg_y') . repeater(NBS, 5) . form_radio(array('name' => 'm_field_cp_reg', 'id' => 'm_field_cp_reg_n', 'value' => 'n', 'checked' => $m_field_cp_reg == 'y' ? FALSE : TRUE)) . NBS . lang('no', 'm_field_cp_reg_n')));
echo $this->table->generate();
?>
			
			<p><span class="notice">*</span> <?php 
echo lang('required_fields');
?>
</p>
			
			<p><?php 
echo form_submit('', $submit_label, 'class="submit"');
?>
</p>

			<?php 
echo form_close();
Esempio n. 25
0
echo lang('select_categories');
?>
</span>
						<select name="parameters[category][]" multiple="multiple" size="10">
						<?php 
foreach ($category_groups as $group) {
    ?>
							<optgroup label="<?php 
    echo htmlspecialchars($group['group_name']);
    ?>
">
							<?php 
    foreach ($group['categories'] as $v) {
        ?>
								<?php 
        $indent = ($i = $v[5] - 1) ? repeater(NBS . NBS, $i) : '';
        ?>
								<option value="<?php 
        echo $v[0];
        ?>
"<?php 
        if (in_array($v[0], $selected_category_ids)) {
            ?>
 selected="selected"<?php 
        }
        ?>
>
									<?php 
        echo $indent . htmlspecialchars($v[1]);
        ?>
								</option>
Esempio n. 26
0
 /**
  * View XML
  *
  * View XML in browser
  * 
  * @access	private
  * @return	void
  */
 function view_xml($xml)
 {
     if (!$this->cp->allowed_group('can_access_tools') or !$this->cp->allowed_group('can_access_utilities')) {
         show_error($this->lang->line('unauthorized_access'));
     }
     $this->load->helper('string');
     $this->cp->set_variable('cp_page_title', $this->lang->line('view_xml'));
     $this->cp->set_breadcrumb(BASE . AMP . 'C=tools_utilities' . AMP . 'M=member_import', $this->lang->line('member_import_utility'));
     $xml = str_replace("\n", BR, htmlentities($xml));
     $xml = str_replace("\t", repeater(NBS, 4), $xml);
     $vars['output'] = $xml;
     $vars['heading'] = $this->lang->line('view_xml');
     $this->load->view('tools/view_xml', $vars);
 }
Esempio n. 27
0
		<?php 
}
?>
	</div>

	<div class="clear"></div>

	<p>
		<?php 
echo form_label(lang('category_parent'), 'parent_id');
?>
<br />
		<?php 
$options['0'] = $this->lang->line('none');
foreach ($parent_id_options as $val) {
    $indent = $val['5'] != 1 ? repeater(NBS . NBS . NBS . NBS, $val['5']) : '';
    $options[$val['0']] = $indent . $val['1'];
}
echo form_dropdown('parent_id', $options, $parent_id, 'id="parent_id"');
?>
	</p>

	<?php 
foreach ($cat_custom_fields as $field) {
    ?>
		<p>
			<label for="<?php 
    echo $field['field_id'];
    ?>
">
				<?php 
Esempio n. 28
0
 /**
  * View XML
  *
  * View XML in browser
  *
  * @return	void
  */
 public function view_xml($xml)
 {
     if (!$this->cp->allowed_group('can_access_tools', 'can_access_utilities')) {
         show_error(lang('unauthorized_access'));
     }
     $this->view->cp_page_title = lang('view_xml');
     $this->cp->set_breadcrumb(BASE . AMP . 'C=tools_utilities' . AMP . 'M=member_import', lang('member_import_utility'));
     $xml = str_replace("\n", BR, htmlentities($xml));
     $xml = str_replace("\t", repeater(NBS, 4), $xml);
     $vars['output'] = $xml;
     $vars['heading'] = lang('view_xml');
     $this->cp->render('tools/view_xml', $vars);
 }
Esempio n. 29
0
 /**
  *  Add/edit slides within a slider
  */
 public function slides($id = FALSE)
 {
     if ($id === FALSE) {
         redirect('admin/pmaker');
     }
     //load files model
     $this->load->model('files/file_folders_m');
     //get files folders
     $file_folders = $this->file_folders_m->get_folders();
     $folders_tree = array();
     foreach ($file_folders as $folder) {
         $indent = repeater('&raquo; ', $folder->depth);
         $folders_tree[$folder->id] = $indent . $folder->name;
     }
     //get this slider
     $slider = $this->pmslider_m->get_by('id', $id);
     //get slides of this slider
     $slides = $this->pmslide_m->get_slides($id);
     $this->template->title($this->module_details['name'])->set('folders_tree', $folders_tree)->set('slider', $slider)->set('slides', $slides)->build('admin/slide');
 }
Esempio n. 30
0
    $item[] = block_div($change_count_div_id, $product->change_count);
    echo block_editor($change_count_div_id, 'name_form', $update_instock_url, "{id: {$apply_id}, type: 'change_count'}");
    $item[] = $product->updated_time;
    $item[] = $options;
    $data[] = $item;
}
$options = array();
$options[''] = lang('all');
foreach ($purchase_users as $purchase_user) {
    $options[$purchase_user->u_id] = $purchase_user->u_name;
}
$filters = array(NULL, array('type' => 'input', 'field' => 'sku', 'method' => '='), array('type' => 'input', 'field' => 'shelf_code'), NULL, array('type' => 'input', 'field' => 'product_basic.name_cn|product_basic.name_en'), array('type' => 'dropdown', 'field' => 'user.id', 'options' => $options, 'method' => '='), array('type' => 'input', 'field' => 'product_more.stock_count', 'size' => 6), NUll);
$config = array('filters' => $filters);
echo block_header(lang('product_instock_verify'));
echo $this->block->generate_pagination('product_apply');
echo form_open();
echo $this->block->generate_reset_search($config);
echo $this->block->generate_table($head, $data, $filters, 'product_apply');
echo form_close();
echo $this->block->generate_check_all();
$batch_verify_url = site_url('stock/inout/proccess_batch_instock_verify');
$config = array('name' => 'batch_approve', 'id' => 'batch_approve', 'value' => lang('batch_approve'), 'type' => 'button', 'onclick' => "batch_verify_apply_instock('{$batch_verify_url}', 1);");
$batch_verify = '<div style="padding-top: 5px; float: right; ">';
$batch_verify .= block_button($config);
$batch_verify .= repeater('&nbsp;', 4);
$config = array('name' => 'batch_reject', 'id' => 'batch_reject', 'value' => lang('batch_reject'), 'type' => 'button', 'onclick' => "batch_verify_apply_instock('{$batch_verify_url}', -1);");
$batch_verify .= block_button($config);
$batch_verify .= '</div>';
echo $batch_verify;
echo '<div style="clear:both;"></div>';
echo $this->block->generate_pagination('product_apply');