/**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $key = Helper::post('key');
     $data = Helper::post('data', false);
     $pid = Helper::post('pid');
     $uid = Helper::post('uid');
     if (method_exists($this, $key)) {
         return $this->{$key}($data);
     } else {
         return new DataResponse();
     }
 }
Beispiel #2
0
 /**
  * @param $data
  * @return \Doctrine\DBAL\Driver\Statement|int
  */
 public function insertWithId($data)
 {
     $task['id'] = $data['id'];
     $task['is_project'] = $data['is_project'];
     $task['type'] = $data['type'] ? $data['type'] : 'task';
     $task['text'] = $data['text'];
     $task['users'] = $data['users'];
     $task['start_date'] = Helper::toTimeFormat($data['start_date']);
     $task['end_date'] = Helper::toTimeFormat($data['end_date']);
     $task['duration'] = $data['duration'] ? $data['duration'] : 0;
     $task['order'] = $data['order'] ? $data['order'] : 0;
     $task['progress'] = $data['progress'] ? $data['progress'] : 0;
     $task['sortorder'] = $data['sortorder'] ? $data['sortorder'] : 0;
     $task['parent'] = $data['parent'] ? $data['parent'] : 1;
     $result = $this->connect->db->insertIfNotExist($this->tableName, $task);
     if ($result) {
         return $this->connect->db->lastInsertId();
     }
     return $result;
 }
 public function logoBaseEncode()
 {
     $data = Helper::post('data', false);
     $src = $data['logo_src'];
     $params = ['src' => Helper::prevImg($src), 'error' => null, 'errorinfo' => ''];
     return new DataResponse($params);
 }
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     // mostly for the home storage's free space
     //$dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
     //$storageInfo = \OC_Helper::getStorageInfo('/', $dirInfo);
     //$dirCont = \OC\Files\Filesystem::getMountManager()->getAll(); //getDirectoryContent('/');
     //$dir = \OCA\Files\Helper::getFiles('/');
     //$files = \OCA\Files\Helper::populateTags($dir);
     //        $files = \OCA\Files\Helper::getFiles('/');
     //        foreach($files as $file){
     //            var_dump(\OCA\Files\Helper::formatFileInfo($file));
     //        }
     //$navItems = \OCA\Files\App::getNavigationManager()->getAll();
     //var_dump($navItems);
     //var_dump($dir);
     //var_dump($files);
     //die;
     $result = $this->connect->project()->get();
     if (!$result) {
         $result = [];
     }
     $statistic = [];
     $statistic['tasks_finished'] = $this->connect->task()->getCountFinishedTasks();
     $statistic['all_tasks'] = $this->connect->task()->getCountAllTasks();
     $talks = $this->connect->talks->get();
     $partTalks = 0;
     function rec_search($this_id, &$arr_subscribers, $talks)
     {
         for ($j = 0; $j < count($talks); $j++) {
             if ($talks[$j]['rid'] == $this_id) {
                 $arr_subscribers = array_merge($arr_subscribers, explode(",", $talks[$j]['subscribers']));
                 array_push($arr_subscribers, $talks[$j]['author']);
                 rec_search($talks[$j]['id'], $arr_subscribers, $talks);
             }
         }
     }
     for ($i = 0; $i < count($talks); $i++) {
         if ($talks[$i]['rid'] == 0) {
             $arr_subscribers = [];
             $this_id = $talks[$i]['id'];
             $arr_subscribers = array_merge($arr_subscribers, explode(",", $talks[$i]['subscribers']));
             array_push($arr_subscribers, $talks[$i]['author']);
             rec_search($this_id, $arr_subscribers, $talks);
             if (in_array($this->userId, $arr_subscribers)) {
                 $partTalks++;
             }
         }
     }
     $statistic['participating_talks'] = $partTalks;
     $statistic['all_talks'] = count($this->connect->talks->getAllTalks());
     $statistic['users'] = count($this->connect->users->getAllUsers());
     $allActivity = $this->connect->activity->get();
     $countCreatedFiles = 0;
     $countDeletedFiles = 0;
     for ($i = 0; $i < count($allActivity); $i++) {
         if ($allActivity[$i]['type'] == "file_created" && $allActivity[$i]['app'] == "files" && $allActivity[$i]['subject'] == "created_self" && !empty($allActivity[$i]['subjectparams']) && $allActivity[$i]['object_type'] == "files") {
             $countCreatedFiles++;
         }
     }
     for ($i = 0; $i < count($allActivity); $i++) {
         if ($allActivity[$i]['type'] == "file_deleted" && $allActivity[$i]['app'] == "files" && $allActivity[$i]['subject'] == "deleted_self" && !empty($allActivity[$i]['subjectparams']) && $allActivity[$i]['object_type'] == "files") {
             $countDeletedFiles++;
         }
     }
     $statistic['all_files'] = $countCreatedFiles - $countDeletedFiles;
     $statistic['all_groups'] = count($this->connect->groups->get());
     $statistic['tasks_progress'] = 100 * $statistic['tasks_finished'] / $statistic['all_tasks'];
     $statistic['talks_progress'] = 100 * $statistic['participating_talks'] / $statistic['all_talks'];
     $projectName = $this->connect->task()->getById(1);
     $result['logo_src'] = Helper::prevImg($result['logo']);
     $params = ['sub_url' => '', 'body_url' => '', 'current_user' => $this->userId, 'current_val' => $result, 'statistic' => $statistic, 'projectName' => $projectName['text']];
     $params['sub_url'] = urldecode("Help me working in my project " . $projectName['text']);
     $params['body_url'] = urldecode("Hi there, currently I am working on the project " . $projectName['text'] . " and I will need some help with it. Please let me know, if you have resources to join the project.");
     return new TemplateResponse($this->appName, 'main', $params);
 }
Beispiel #5
0
$container->query('OCP\\INavigationManager')->add(function () use($container, $appName) {
    $urlGenerator = $container->query('OCP\\IURLGenerator');
    $l10n = $container->query('OCP\\IL10N');
    return ['id' => $appName, 'order' => 10, 'href' => $urlGenerator->linkToRoute($appName . '.main.index'), 'icon' => $urlGenerator->imagePath($appName, 'app.svg'), 'name' => $l10n->t('DashBoard')];
});
/**
 * Loading translations
 * The string has to match the app's folder name
 */
Util::addTranslations($appName);
/**
 * Application styles and scripts
 */
if (Helper::isApp($appName)) {
    Util::addStyle($appName, 'main');
    Util::addStyle($appName, 'media');
    Util::addStyle($appName, 'jquery-ui-timepicker');
    //	Util::addStyle($appName, 'jquery.custom-scrollbar');
    //	Util::addScript($appName,'jquery-ui-timepicker');
    //	Util::addScript($appName, 'jquery.custom-scrollbar');
    Util::addScript($appName, 'libs/jquery-ui-timepicker');
    Util::addScript($appName, 'libs/an.script_1.0.2');
    Util::addScript($appName, 'libs/ns.application');
    Util::addScript($appName, 'init');
}
/**
 * Detect and appoints styles and scripts for particular app page
 */
$currentUri = Helper::getCurrentUri($appName);
if ($currentUri == '/') {
}