예제 #1
0
 function widget_options($meta_key = null, $post_id = null)
 {
     if (!$this->users->logged_in()) {
         r_direct_login();
     } elseif ($meta_key) {
         $delimiter = $this->application->get_config('metakey_delimiter', 'template');
         $keys = array();
         $meta_key = urldecode($meta_key);
         $is_statistics = false;
         $widget_key = extract_metakey($meta_key, $delimiter);
         $exist = file_exists(FCPATH . '\\application\\views\\widgets\\' . $widget_key);
         if ($exist) {
             $folder = $widget_key;
             $widget_key = $meta_key;
         } else {
             $keys = $this->statistics_lib->extract_statistics_key($widget_key);
             $folder = element('type', $keys);
             $is_statistics = true;
         }
         $method = $this->input->server('REQUEST_METHOD');
         if ($method == 'POST') {
             header('Content-Type: application/json');
             $parameters = $_POST;
             $widget = array('post_id' => $post_id, 'meta_key' => $meta_key, 'meta_value' => serialize($parameters));
             if ($this->widgets_model->get_widgetoptions(array('post_id' => $post_id, 'meta_key' => $meta_key))) {
                 $res = $this->widgets_model->update_widgetoptions($post_id, $meta_key, $widget);
             } else {
                 $res = $this->widgets_model->save_widgetoptions($widget);
             }
             if ($res) {
                 $this->session->set_flashdata('message', $this->notification->messages());
                 echo json_encode(array('response' => 'success', 'message' => $this->notification->messages()), true);
             } else {
                 $message = validation_errors() ? validation_errors() : ($this->notification->errors() ? $this->notification->errors() : $this->session->flashdata('message'));
                 $this->session->set_flashdata('message', $message);
                 echo json_encode(array('response' => 'danger', 'message' => $message), true);
             }
         } else {
             if ($is_statistics) {
                 $data['modal_title'] = element('type', $keys) . " Options";
             } else {
                 $data['modal_title'] = 'Widget Options';
             }
             $data['modal_content'] = 'widgets/' . $folder . '/options';
             $data['widget_key'] = $widget_key;
             $data['meta_key'] = $meta_key;
             echo $this->load->view('template/modal-widget-options', $data);
         }
     } else {
     }
 }
예제 #2
0
<?php

/* 
	Parameters
		meta_key		(required)
*/
?>

<?php 
$delimiter = $this->application->get_config('metakey_delimiter', 'template');
$is_statistics = false;
$widget_key = extract_metakey($meta_key, $delimiter);
$exist = file_exists(FCPATH . '\\application\\views\\widgets\\' . $widget_key);
$widgets_tool = $this->application->get_session_userdata('widgets_tool');
$widgets_js = $this->application->get_session_userdata('widgets_js');
if ($exist) {
    $folder = $widget_key;
    $widget_key = $meta_key;
} else {
    $keys = $this->statistics_lib->extract_statistics_key($widget_key);
    $folder = element('type', $keys);
    $is_statistics = true;
}
$tools_exist = file_exists(FCPATH . '\\application\\views\\widgets\\' . $folder . '\\tools.php');
$tool = 'widgets/' . $folder . '/tools';
if ($tools_exist && !in_array($tool, $widgets_tool)) {
    array_push($widgets_tool, $tool);
    $this->session->set_userdata('widgets_tool', $widgets_tool);
}
$js_exist = file_exists(FCPATH . '\\application\\views\\widgets\\' . $folder . '\\index.js');
$js = 'application/views/widgets/' . $folder . '/index.js';
예제 #3
0
						<div class="p-relative" >
							<div id="right_column" 
								data-form="<?php 
echo $form_to_submit;
?>
" 
								class="<?php 
echo $mode ? 'connected-widgets widget' : '';
?>
 widget-xl">	
								<?php 
if (element('right_column', $dashboard_settings)) {
    foreach (element('right_column', $dashboard_settings) as $key => $widget_key) {
        $this->data['widget_key'] = $widget_key;
        echo '<div class="removable-widget" data-widget="' . $widget_key . '">';
        $this->load->view('widgets/' . extract_metakey($widget_key, $delimiter) . '/view', $this->data);
        echo '</div>';
    }
}
?>
							</div>
							<?php 
if ($mode) {
    echo $loading_state;
}
?>
						</div>		
						
					</div>
				</div>
</section>