Пример #1
0
 public function add($title, $plugin = 'app', $app_id = null, $app_action = 'index', $icon = null, $post_app_params = null, $location = null, $id_parent, $content = null)
 {
     if (is_array($post_app_params)) {
         $c = count($post_app_params);
         if ($c != 0) {
             $app_params = array();
             foreach ($post_app_params as $key => $value) {
                 $app_params[] = $key . ':' . $value;
             }
             $db_app_params = implode(',', $app_params);
         }
     }
     global $my_user;
     if ($icon == 'null') {
         $icon = '';
     }
     $items = array('file_title' => filter::utf($title), 'id_user' => $my_user->get_id_user(), 'id_parent' => filter::num($id_parent), 'plugin_id' => filter::alfas($plugin), 'app_id' => filter::alfas($app_id), 'app_action' => filter::alfas($app_action), 'created_at' => time(), 'modified_at' => time(), 'app_params' => $db_app_params, 'location' => filter::alfa($location), 'icon' => filter::fname($icon), 'content' => $content);
     global $sql;
     if (false !== ($record_id = $sql->add($this->db_shortcuts, $items))) {
         return $record_id;
     } else {
         return false;
     }
 }
require_once PHPOS_DIR . 'classes/class.phpos_icons.php';
require_once PHPOS_DIR . 'classes/class.phpos_navigation.php';
require_once PHPOS_DIR . 'classes/class.phpos_explorer_api.php';
require_once PHPOS_DIR . 'classes/class.phpos_messages.php';
activity();
/*
**************************
*/
if (!empty($_POST['id'])) {
    $_GET['id'] = filter::num($_POST['id']);
}
/*
**************************
*/
$apiWindow = new api_wintask();
$apiWindow->setID(filter::num($_GET['id']));
// set ID of my window
$apiWindow->getWindow();
// get Window data
define("WIN_ID", $apiWindow->getID());
// Get APP ID
$app = $apiWindow->getAPPID();
$app_name = $apiWindow->get_app_name();
if (!empty($_GET['action'])) {
    $apiWindow->setAPPID($app_name . '@' . filter::alfas($_GET['action']));
    $apiWindow->updateWindow();
}
$app_action = $apiWindow->get_app_action();
define("APP_ID", $app_name);
define("APP_ACTION", $app_action);
define("WIN_TYPE", $apiWindow->getParam('wintype'));
                foreach ($_SESSION['tasks'] as $key => $value) {
                    if ($key != 1) {
                        $win_task = new api_wintask();
                        $win_task->setID($_SESSION['tasks'][$key]['id']);
                        $win_task->getWindow();
                        $win_task->generateJavaScript('notags');
                        $js_code .= $win_task->getJavaScript();
                    }
                    unset($win_task);
                }
            }
            break;
        case 'update':
            if (isset($_GET['id'])) {
                $win_task = new api_wintask();
                $win_task->setID(filter::num($_GET['id']));
                $win_task->getWindow();
                $win_task->setParams($_GET['parameters_parsed']);
                $win_task->updateWindow();
                unset($win_task);
            }
            break;
        default:
            break;
    }
}
// if !action
if ($_GET['action'] != 'update') {
    $t = new phpos_tasks();
    echo $t->render_tasks();
    $js_context_menu = $t->get_jquery();