diff --git a/wecker_manufaktur/page/default_page/default_page.php b/wecker_manufaktur/page/default_page/default_page.php index 583a740..25ed499 100644 --- a/wecker_manufaktur/page/default_page/default_page.php +++ b/wecker_manufaktur/page/default_page/default_page.php @@ -17,10 +17,6 @@ class default_page implements \SYSTEM\PAGE\DefaultPage { ))); } - const BADGE_TYPE_PERSON_ABILITIES = 1; - const BADGE_TYPE_PROJECT_FOCUS = 10; - const BADGE_TYPE_PROJECT_TYPE = 11; - private static function getPersons(){ $result = ''; @@ -29,14 +25,14 @@ class default_page implements \SYSTEM\PAGE\DefaultPage { $_content_details = ''; $persons = \SQL\SELECT_PERSONS::QQ(); - $person_badges = \SQL\SELECT_BADGES::QA(array(self::BADGE_TYPE_PERSON_ABILITIES)); // This part we filter phpside due to performance. + $person_badges = \SQL\SELECT_BADGES_VISIBLE::QA(array(\SAI\saimod_project::BADGE_TYPE_PERSON_ABILITIES)); // This part we filter phpside due to performance. $person_projects= \SQL\SELECT_PERSON_PROJECTS::QA(); // This part we filter phpside due to performance. while($row = $persons->next()){ $badges = array_filter($person_badges, function($v)use($row){return $v['ref_id'] == $row['id'];}); $row['badges'] = ''; foreach($badges as $badge){ - $row['badges'] .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/content_badge.tpl'))->SERVERPATH(),$badge); + $row['badges'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/content_badge.tpl'))->SERVERPATH(),$badge); } $projects = array_filter($person_projects, function($v)use($row){return $v['person'] == $row['id'];}); @@ -79,22 +75,22 @@ class default_page implements \SYSTEM\PAGE\DefaultPage { $_content_imgs = ''; $_content_details = ''; - $projects = \SQL\SELECT_PROJECTS::QQ(); - $project_focus = \SQL\SELECT_BADGES::QA(array(self::BADGE_TYPE_PROJECT_FOCUS)); // This part we filter phpside due to performance. - $project_type = \SQL\SELECT_BADGES::QA(array(self::BADGE_TYPE_PROJECT_TYPE)); // This part we filter phpside due to performance. - $project_persons= \SQL\SELECT_PROJECT_PERSONS::QA(); // This part we filter phpside due to performance. + $projects = \SQL\SELECT_PROJECTS_VISIBLE::QQ(); + $project_focus = \SQL\SELECT_BADGES_VISIBLE::QA(array(\SAI\saimod_project::BADGE_TYPE_PROJECT_FOCUS)); // This part we filter phpside due to performance. + $project_type = \SQL\SELECT_BADGES_VISIBLE::QA(array(\SAI\saimod_project::BADGE_TYPE_PROJECT_TYPE)); // This part we filter phpside due to performance. + $project_persons= \SQL\SELECT_PROJECT_PERSONS::QA(); // This part we filter phpside due to performance. while($row = $projects->next()){ $focus = array_filter($project_focus, function($v)use($row){return $v['ref_id'] == $row['id'];}); $row['focus'] = ''; foreach($focus as $f){ - $row['focus'] .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/content_badge.tpl'))->SERVERPATH(),$f); + $row['focus'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/content_badge.tpl'))->SERVERPATH(),$f); } $type = array_filter($project_type, function($v)use($row){return $v['ref_id'] == $row['id'];}); $row['type'] = ''; foreach($type as $t){ - $row['type'] .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/content_badge.tpl'))->SERVERPATH(),$t); + $row['type'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/content_badge.tpl'))->SERVERPATH(),$t); } $persons = array_filter($project_persons, function($v)use($row){return $v['project'] == $row['id'];}); diff --git a/wecker_manufaktur/page/default_page/sql/SELECT_BADGES.php b/wecker_manufaktur/page/default_page/sql/SELECT_BADGES_VISIBLE.php similarity index 93% rename from wecker_manufaktur/page/default_page/sql/SELECT_BADGES.php rename to wecker_manufaktur/page/default_page/sql/SELECT_BADGES_VISIBLE.php index 1ce289a..c0a1cae 100644 --- a/wecker_manufaktur/page/default_page/sql/SELECT_BADGES.php +++ b/wecker_manufaktur/page/default_page/sql/SELECT_BADGES_VISIBLE.php @@ -14,7 +14,7 @@ namespace SQL; /** * QQ to get System Api Tree by group */ -class SELECT_BADGES extends \SYSTEM\DB\QP { +class SELECT_BADGES_VISIBLE extends \SYSTEM\DB\QP { /** * Get Classname of the QQ * diff --git a/wecker_manufaktur/page/default_page/sql/SELECT_PROJECTS.php b/wecker_manufaktur/page/default_page/sql/SELECT_PROJECTS_VISIBLE.php similarity index 93% rename from wecker_manufaktur/page/default_page/sql/SELECT_PROJECTS.php rename to wecker_manufaktur/page/default_page/sql/SELECT_PROJECTS_VISIBLE.php index c07aecd..8820e5d 100644 --- a/wecker_manufaktur/page/default_page/sql/SELECT_PROJECTS.php +++ b/wecker_manufaktur/page/default_page/sql/SELECT_PROJECTS_VISIBLE.php @@ -14,7 +14,7 @@ namespace SQL; /** * QQ to get System Api Tree by group */ -class SELECT_PROJECTS extends \SYSTEM\DB\QQ { +class SELECT_PROJECTS_VISIBLE extends \SYSTEM\DB\QQ { /** * Get Classname of the QQ * diff --git a/wecker_manufaktur/path/autoload.inc b/wecker_manufaktur/path/autoload.inc index d94a324..e2c9da4 100644 --- a/wecker_manufaktur/path/autoload.inc +++ b/wecker_manufaktur/path/autoload.inc @@ -1,2 +1,2 @@ seek(25*$page); + + $count_filtered = 0; + while(($row = $res->next()) && ($count_filtered < 25)){ + $ffocus = array_filter($focus, function($v)use($row){return $v['ref_id'] == $row['id'];}); + $row['focus'] = ''; + foreach($ffocus as $f){ + $row['focus'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/content_badge.tpl'))->SERVERPATH(),$f); + } + + $ftype = array_filter($type, function($v)use($row){return $v['ref_id'] == $row['id'];}); + $row['type'] = ''; + foreach($ftype as $t){ + $row['type'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/content_badge.tpl'))->SERVERPATH(),$t); + } + + $row['selected_invisible'] = $row['visible'] !== 1 ? 'selected' : ''; + $row['selected_visible'] = $row['visible'] == 1 ? 'selected' : ''; + + $vars['data'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/saimod_projects_tr.tpl'))->SERVERPATH(),$row); + $count_filtered++; + } + // Pagintation + $vars['pagination'] = ''; + $vars['page_last'] = floor($count/25); + for($i=0;$i < ceil($count/25);$i++){ + $data = array('page' => $i,'search' => $search, 'active' => ($i == $page) ? 'active' : ''); + $vars['pagination'] .= \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/saimod_project_pagination.tpl'))->SERVERPATH(), $data); + } + $vars['count'] = ($count_filtered+$page*25).'/'.$count; + + return \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/saimod_project.tpl'))->SERVERPATH(),$vars); + } + + public static function sai_mod__SAI_saimod_project_action_project_delete($data){ + foreach($data as $id){ + \SQL\DELETE_PROJECT::QI(array($id)); + \SQL\DELETE_BADGE::QI(array(self::BADGE_TYPE_PROJECT_FOCUS,$id)); + \SQL\DELETE_BADGE::QI(array(self::BADGE_TYPE_PROJECT_TYPE,$id)); + } + return \JsonResult::ok(); + } + public static function sai_mod__SAI_saimod_project_action_project_order($data){ + $project = $data['project']; + switch($data['action']){ + case 'up': + $new_order = $data['order'] -1; + $new_order = $new_order > 0 ? $new_order : 1; + \SQL\UPDATE_PROJECTS_ORDER_DOWN_ORDER::QI(array($new_order)); + \SQL\UPDATE_PROJECTS_ORDER_DOWN_ID::QI(array($project)); + break; + case 'down': + $new_order = $data['order'] +1; + \SQL\UPDATE_PROJECTS_ORDER_UP_ORDER::QI(array($new_order)); + \SQL\UPDATE_PROJECTS_ORDER_UP_ID::QI(array($project)); + break; + default: + throw new \SYSTEM\LOG\ERROR('Operration not supported'); + } + return \SYSTEM\LOG\JsonResult::ok(); + } + public static function sai_mod__SAI_saimod_project_action_project_visibility($data){ + \SQL\UPDATE_PROJECTS_VISIBILITY::QI(array($data['visibility'],$data['project'])); + return \SYSTEM\LOG\JsonResult::ok(); + } + + public static function menu(){ + return new \SYSTEM\SAI\sai_module_menu( 101, + \SYSTEM\SAI\sai_module_menu::POISITION_LEFT, + \SYSTEM\SAI\sai_module_menu::DIVIDER_LEFT, + \SYSTEM\PAGE\replace::replaceFile((new \SAI\PPROJECT('tpl/menu.tpl'))->SERVERPATH()));} + public static function right_public(){return false;} + public static function right_right(){return \SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} + + public static function js(){ + return array(new \SAI\PPROJECT('js/saimod_project.js'));} +} \ No newline at end of file diff --git a/wecker_manufaktur/sai/saimod_project/sql/COUNT_PROJECTS.php b/wecker_manufaktur/sai/saimod_project/sql/COUNT_PROJECTS.php new file mode 100644 index 0000000..a28359a --- /dev/null +++ b/wecker_manufaktur/sai/saimod_project/sql/COUNT_PROJECTS.php @@ -0,0 +1,14 @@ +SERVERPATH(), + (new \SAI\PPROJECT('sql/mysql/system_api.sql'))->SERVERPATH(), + (new \SAI\PPROJECT('sql/mysql/persons.schema.sql'))->SERVERPATH(), + (new \SAI\PPROJECT('sql/mysql/badges.schema.sql'))->SERVERPATH(), + (new \SAI\PPROJECT('sql/mysql/projects.schema.sql'))->SERVERPATH(), + (new \SAI\PPROJECT('sql/mysql/person_projects.schema.sql'))->SERVERPATH()); + } +} \ No newline at end of file diff --git a/wecker_manufaktur/sai/saimod_project/sql/DELETE_BADGE.php b/wecker_manufaktur/sai/saimod_project/sql/DELETE_BADGE.php new file mode 100644 index 0000000..1c2f6a3 --- /dev/null +++ b/wecker_manufaktur/sai/saimod_project/sql/DELETE_BADGE.php @@ -0,0 +1,33 @@ + + + + +   Project + + \ No newline at end of file diff --git a/wecker_manufaktur/sai/saimod_project/tpl/saimod_project.tpl b/wecker_manufaktur/sai/saimod_project/tpl/saimod_project.tpl new file mode 100644 index 0000000..7ab052d --- /dev/null +++ b/wecker_manufaktur/sai/saimod_project/tpl/saimod_project.tpl @@ -0,0 +1,41 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + ${data} +
+ Rows: ${count} Page: ${page} +
+ + + +
ImageNameInfoFocusTypeWebsiteOrderVisible + + +
+ +
+
\ No newline at end of file diff --git a/wecker_manufaktur/sai/saimod_project/tpl/saimod_project_pagination.tpl b/wecker_manufaktur/sai/saimod_project/tpl/saimod_project_pagination.tpl new file mode 100644 index 0000000..4091843 --- /dev/null +++ b/wecker_manufaktur/sai/saimod_project/tpl/saimod_project_pagination.tpl @@ -0,0 +1 @@ +
  • ${page}
  • \ No newline at end of file diff --git a/wecker_manufaktur/sai/saimod_project/tpl/saimod_projects_tr.tpl b/wecker_manufaktur/sai/saimod_project/tpl/saimod_projects_tr.tpl new file mode 100644 index 0000000..b084f01 --- /dev/null +++ b/wecker_manufaktur/sai/saimod_project/tpl/saimod_projects_tr.tpl @@ -0,0 +1,21 @@ + + + ${name} + ${info} + ${focus} + ${type} + ${website} + + + + + + + + + + + \ No newline at end of file diff --git a/wecker_manufaktur/sql/DATA_WECKER_MANUFAKTUR.php b/wecker_manufaktur/sql/DATA_WECKER_MANUFAKTUR.php index 29226b5..5f2f9ef 100644 --- a/wecker_manufaktur/sql/DATA_WECKER_MANUFAKTUR.php +++ b/wecker_manufaktur/sql/DATA_WECKER_MANUFAKTUR.php @@ -4,10 +4,6 @@ class DATA_WECKER_MANUFAKTUR extends \SYSTEM\DB\QI { public static function get_class(){return \get_class();} public static function files_mysql(){ return array( (new \PSQL('/mysql/system_page.sql'))->SERVERPATH(), - (new \PSQL('/mysql/system_text.sql'))->SERVERPATH(), - (new \PSQL('/mysql/persons.schema.sql'))->SERVERPATH(), - (new \PSQL('/mysql/badges.schema.sql'))->SERVERPATH(), - (new \PSQL('/mysql/projects.schema.sql'))->SERVERPATH(), - (new \PSQL('/mysql/person_projects.schema.sql'))->SERVERPATH()); + (new \PSQL('/mysql/system_text.sql'))->SERVERPATH()); } } \ No newline at end of file