Changeset 1879390
- Timestamp:
- 05/22/2018 07:00:22 PM (8 years ago)
- Location:
- awesome-project-manager/trunk
- Files:
-
- 1 added
- 8 edited
-
advanced-pm.php (added)
-
assets/css/style.css (modified) (1 diff)
-
classes/class-ajax.php (modified) (25 diffs)
-
classes/class-install.php (modified) (1 diff)
-
classes/class-localize.php (modified) (7 diffs)
-
models/Activity.php (modified) (3 diffs)
-
models/Message.php (modified) (1 diff)
-
models/Todo.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
awesome-project-manager/trunk/assets/css/style.css
r1814388 r1879390 197 197 @media only screen and (min-width: 60em) { /* 960px */ 198 198 .container { 199 width: 75%;200 max-width: 60rem;199 width: 80%; 200 max-width: 70rem; 201 201 } 202 202 } -
awesome-project-manager/trunk/classes/class-ajax.php
r1814388 r1879390 27 27 add_action( 'wp_ajax_fpm-load-more-projects', array( $this, 'load_more_projects' ), 10 ); 28 28 29 // add_action( 'wp_ajax_fpm-get-message-count', array( $this, 'fetch_message_count' ), 10 );30 29 add_action( 'wp_ajax_fpm-load-more-messages', array( $this, 'load_more_messages' ), 10 ); 31 30 add_action( 'wp_ajax_fpm-load-more-lists', array( $this, 'load_more_lists' ), 10 ); … … 96 95 public function create_activity( $data ) { 97 96 $activityModel = FusionPM_Activity::init(); 97 98 if ( $data['activity_type'] === 'delete_todo' ) { 99 $activityModel->delete_activities_by_column( $data['activity_id'], 'create_todo', $data['projectID'] ); 100 $activityModel->delete_activities_by_column( $data['activity_id'], 'check_todo', $data['projectID'] ); 101 $activityModel->delete_activities_by_column( $data['activity_id'], 'uncheck_todo', $data['projectID'] ); 102 } 103 if ( $data['activity_type'] === 'delete_message' ) { 104 $activityModel->delete_activities_by_column( $data['activity_id'], 'create_message', $data['projectID'] ); 105 } 98 106 $activityModel->create( $data ); 99 107 } … … 225 233 'user' => array( 226 234 'ID' => $user_id, 227 'user_name' => $user-> display_name,235 'user_name' => $user->user_login, 228 236 'avatar_url' => get_avatar_url($user_id, array('size'=>50)) 229 237 ) … … 265 273 'user' => array( 266 274 'ID' => $user_id, 267 'user_name' => $user-> display_name,275 'user_name' => $user->user_login, 268 276 'avatar_url' => get_avatar_url($user_id, array('size'=>50)) 269 277 ) … … 351 359 $messageModel = FusionPM_Message::init(); 352 360 353 $userObject = get_user_by( 'ID', get_current_user_id());361 $userObject = wp_get_current_user(); 354 362 355 363 $date = current_time( 'mysql' ); … … 360 368 'userID' => $userObject->ID, 361 369 'projectID' => $projectID, 362 'user_name' => $userObject-> display_name,370 'user_name' => $userObject->user_login, 363 371 'project_title' => $projectTitle, 364 'file_ids' => maybe_serialize( $fileIDs ), 365 'created' => $date 372 'file_ids' => maybe_serialize( $fileIDs ) 366 373 ); 367 374 … … 370 377 $successResponse = $messageModel->update( $data, $where ); 371 378 } else { 379 $data['created'] = $date; 372 380 $insertID = $messageModel->create( $data ); 373 381 } … … 383 391 ); 384 392 393 if ( $insertID ) { 394 $activities = array( 395 'userID' => $userObject->ID, 396 'user_name' => $userObject->user_login, 397 'projectID' => $projectID, 398 'activity_id' => $insertID, 399 'activity_type' => 'create_message', 400 'activity' => $messageTitle, 401 'created' => $date 402 ); 403 404 $this->create_activity($activities); 405 } 406 385 407 if ( $insertID || $successResponse ) { 386 $activityID = $insertID ? $insertID : $messageID;387 $activities = array(388 'userID' => $userObject->ID,389 'user_name' => $userObject->display_name,390 'projectID' => $projectID,391 'activity_id' => $activityID,392 'activity_type' => $insertID ? 'create_message' : 'update_message',393 'activity' => $messageTitle,394 'created' => $date395 );396 397 $this->create_activity($activities);398 399 408 wp_send_json_success( $resp ); 400 409 } … … 417 426 wp_send_json_error( __( 'messageid not provided', 'fusion-pm' ) ); 418 427 } 419 428 $userObject = wp_get_current_user(); 420 429 $messageModel = FusionPM_Message::init(); 421 430 $delete = $messageModel->delete( $messageID ); … … 423 432 if( $delete ) { 424 433 $activities = array( 425 'userID' => $user ID,426 'user_name' => $user Name,434 'userID' => $userObject->ID, 435 'user_name' => $userObject->user_login, 427 436 'projectID' => $projectID, 428 437 'activity_id' => $messageID, … … 520 529 'projectID' => $projectID, 521 530 'userID' => $current_user->ID, 522 'user_name' => $current_user->display_name, 523 'created' => $date 531 'user_name' => $current_user->user_login 524 532 ); 525 533 … … 528 536 $successResponse = $commentModel->update( $data, $where ); 529 537 } else { 538 $data['created'] = $date; 530 539 $insertID = $commentModel->create( $data ); 531 540 } … … 554 563 $assigneeID = get_current_user_id(); 555 564 565 $orderBy = $this->get_validated_input('order_by'); 566 556 567 $todoModel = FusionPM_Todo::init(); 557 568 … … 684 695 685 696 $date = current_time( 'mysql' ); 697 $userObject = wp_get_current_user(); 686 698 687 699 $data = array( 688 700 'todo' => $todo, 689 701 'listID' => $listID, 690 'userID' => get_current_user_id(),691 702 'projectID' => $projectID, 692 'userID' => $user ID,693 'user_name' => $user Name,703 'userID' => $userObject->ID, 704 'user_name' => $userObject->user_login, 694 705 'assignee_name' => $assigneeName, 695 706 'assigneeID' => $assigneeID, 696 707 'file_ids' => maybe_serialize( $fileIDs ), 697 'due_date' => $dueDate, 698 'created' => $date 708 'due_date' => $dueDate 699 709 ); 700 710 … … 703 713 $successResponse = $todosModel->update( $data, $where ); 704 714 } else { 715 $data['created'] = $date; 705 716 $insertID = $todosModel->create( $data ); 706 717 } … … 714 725 715 726 $resp = array( 716 'message' => __( ' Successfully inserted', 'fusion-pm' ),727 'message' => __( 'operation successful', 'fusion-pm' ), 717 728 'todo' => array( 718 729 'ID' => $insertID ? $insertID : $todoID, … … 725 736 ); 726 737 738 if ( $insertID ) { 739 $activities = array( 740 'userID' => $userObject->ID, 741 'user_name' => $userObject->user_login, 742 'projectID' => $projectID, 743 'parentID' => $listID, 744 'activity_id' => $insertID, 745 'activity_type' => 'create_todo', 746 'activity' => $todo, 747 'created' => $date 748 ); 749 750 $this->create_activity($activities); 751 } 752 727 753 if ( $insertID || $successResponse ) { 728 $activityID = $insertID ? $insertID : $todoID;729 $activities = array(730 'userID' => $userID ? $userID : get_current_user_id(),731 'user_name' => $userName,732 'projectID' => $projectID,733 'listID' => $listID,734 'activity_id' => $activityID,735 'activity_type' => $insertID ? 'create_todo' : 'update_todo',736 'activity' => $todo,737 'created' => $date738 );739 740 $this->create_activity($activities);741 742 754 wp_send_json_success( $resp ); 743 755 } … … 767 779 $activities = array( 768 780 'userID' => $userObject->ID, 769 'user_name' => $userObject-> display_name,781 'user_name' => $userObject->user_login, 770 782 'projectID' => $projectID, 771 783 'activity_id' => $todoID, … … 791 803 $listID = !empty( $_POST['list_id'] ) ? $_POST['list_id'] : ''; 792 804 $projectID = !empty( $_POST['project_id'] ) ? $_POST['project_id'] : ''; 793 $userID = !empty( $_POST['user_id'] ) ? $_POST['user_id'] : '';794 $userName = !empty( $_POST['user_name'] ) ? $_POST['user_name'] : '';805 // $userID = !empty( $_POST['user_id'] ) ? $_POST['user_id'] : ''; 806 // $userName = !empty( $_POST['user_name'] ) ? $_POST['user_name'] : ''; 795 807 $todo = !empty( $_POST['todo'] ) ? $_POST['todo'] : ''; 796 808 $currentUser = wp_get_current_user(); 797 809 if( ! $todoID ) { 798 810 wp_send_json_error( __( 'todoid not provided', 'fusion-pm' ) ); … … 807 819 808 820 $activities = array( 809 'userID' => $userID,810 'user_name' => $userName,811 'projectID' => $projectID,812 ' listID'=> $listID,821 'userID' => $currentUser->ID, 822 'user_name' => $currentUser->user_login, 823 'projectID' => $projectID, 824 'parentID' => $listID, 813 825 'activity_id' => $todoID, 814 'activity' => $todo,815 'created' => $date826 'activity' => $todo, 827 'created' => $date 816 828 ); 817 829 … … 862 874 863 875 $date = current_time( 'mysql' ); 876 $userObject = wp_get_current_user(); 864 877 865 878 $data = array( 866 879 'list_title' => $list_title, 867 'userID' => get_current_user_id(), 868 'user_name' => $userName, 869 'projectID' => $projectID, 870 'created' => $date 880 'userID' => $userObject->ID, 881 'user_name' => $userObject->user_login, 882 'projectID' => $projectID 871 883 ); 872 884 … … 877 889 $successResponse = $listModel->update( $data, $where ); 878 890 } else { 891 $data['created'] = $date; 879 892 $insertID = $listModel->create( $data ); 880 893 } … … 959 972 'project_title' => $project_title, 960 973 'project_desc' => $project_desc, 961 'userID' => get_current_user_id(), 962 'created' => $date 974 'userID' => get_current_user_id() 963 975 ); 964 976 … … 969 981 $successResponse = $projectModel->update( $data, $where ); 970 982 } else { 983 $data['created'] = $date; 971 984 $insertID = $projectModel->create( $data ); 972 985 } … … 1139 1152 $projectID = $this->get_validated_input('project_id'); 1140 1153 1141 if(!$projectID) {1142 wp_send_json_error( __( 'projectid not provided', 'fusion-pm' ) );1143 }1144 1145 1154 $activityModel = FusionPM_Activity::init(); 1146 1155 $activites = $activityModel->get_project_activities( $projectID ); -
awesome-project-manager/trunk/classes/class-install.php
r1814388 r1879390 93 93 `user_name` varchar(100), 94 94 `projectID` int(11) unsigned, 95 ` listID` int(11) unsigned,95 `parentID` int(11) unsigned, 96 96 `activity_id` int(11) unsigned, 97 97 `activity_type` varchar(50), -
awesome-project-manager/trunk/classes/class-localize.php
r1814388 r1879390 91 91 'add_remove_people' => __( 'Add/Remove People...', 'fusion-pm' ), 92 92 'todos' => __( 'To-dos', 'fusion-pm' ), 93 'message_board' => __( ' Message Board', 'fusion-pm' ),93 'message_board' => __( 'Discussion', 'fusion-pm' ), 94 94 'project_activity' => __( 'Project Activity', 'fusion-pm' ), 95 95 'create_a_todo' => __( 'created a Todo', 'fusion-pm' ), … … 99 99 'checked_off_todo' => __( 'checked off a Todo', 'fusion-pm' ), 100 100 'reopen_a_todo' => __( 're-open a Todo', 'fusion-pm' ), 101 'created_a_message_called' => __( 'created a Message, called', 'fusion-pm' ),102 'udpated_a_message_called' => __( 'updated a Message, called', 'fusion-pm' ),103 'deleted_a_message_called' => __( 'deleted a Message, called', 'fusion-pm' ),101 'created_a_message_called' => __( 'created a Topic, called', 'fusion-pm' ), 102 'udpated_a_message_called' => __( 'updated a Topic, called', 'fusion-pm' ), 103 'deleted_a_message_called' => __( 'deleted a Topic, called', 'fusion-pm' ), 104 104 'no_activity_yet' => __( 'No activiy yet.', 'fusion-pm' ), 105 105 ); … … 180 180 public function messages_localize_data() { 181 181 $localize_data = array( 182 'add_new_msg_btn' => __( 'Add New Message', 'fusion-pm' ),183 'message_heading' => __( ' MessageBoard', 'fusion-pm' ),184 'no_message_yet' => __( 'No MessageAdded Yet', 'fusion-pm' ),182 'add_new_msg_btn' => __( 'Add New Topic', 'fusion-pm' ), 183 'message_heading' => __( 'Discussion Board', 'fusion-pm' ), 184 'no_message_yet' => __( 'No Topic Added Yet', 'fusion-pm' ), 185 185 'posted_by' => __( 'posted by', 'fusion-pm' ), 186 186 'loading' => __( 'Loading ...', 'fusion-pm' ), … … 200 200 public function single_messages_localize_data() { 201 201 $localize_data = array( 202 'add_new_msg_btn' => __( 'Add New Message', 'fusion-pm' ),203 'message_heading' => __( ' MessageBoard', 'fusion-pm' ),204 'no_message_yet' => __( 'No MessageAdded Yet', 'fusion-pm' ),202 'add_new_msg_btn' => __( 'Add New Topic', 'fusion-pm' ), 203 'message_heading' => __( 'Discussion Board', 'fusion-pm' ), 204 'no_message_yet' => __( 'No Topic Added Yet', 'fusion-pm' ), 205 205 'posted_by' => __( 'posted by', 'fusion-pm' ), 206 206 'loading' => __( 'Loading ...', 'fusion-pm' ), … … 228 228 public function new_messages_localize_data() { 229 229 $localize_data = array( 230 'message_label' => __( ' Messages', 'fusion-pm' ),231 'message_title_placeholder' => __( 'Enter your messagetitle...', 'fusion-pm' ),232 'post_new_msg_btn' => __( 'Post Message', 'fusion-pm' ),230 'message_label' => __( 'Discussions', 'fusion-pm' ), 231 'message_title_placeholder' => __( 'Enter topic title...', 'fusion-pm' ), 232 'post_new_msg_btn' => __( 'Post', 'fusion-pm' ), 233 233 'edit' => __( 'Edit', 'fusion-pm' ), 234 234 'delete' => __( 'Delete', 'fusion-pm' ), … … 250 250 public function edit_messages_localize_data() { 251 251 $localize_data = array( 252 'message_label' => __( ' Messages', 'fusion-pm' ),253 'message_title_placeholder' => __( 'Enter your messagetitle...', 'fusion-pm' ),254 'post_new_msg_btn' => __( 'Post Message', 'fusion-pm' ),252 'message_label' => __( 'Discussions', 'fusion-pm' ), 253 'message_title_placeholder' => __( 'Enter topic title...', 'fusion-pm' ), 254 'post_new_msg_btn' => __( 'Post', 'fusion-pm' ), 255 255 'edit' => __( 'Edit', 'fusion-pm' ), 256 256 'delete' => __( 'Delete', 'fusion-pm' ), … … 287 287 'header_label' => __( 'Set up who’s on ', 'fusion-pm' ), 288 288 'header_note' => __( 289 'Everyone below will be able to sign in to project manager and collaborate with you on this project (make to-dos, post messages, upload files, etc.).', 'fusion-pm'289 'Everyone below will be able to sign in to project manager and collaborate with you on this project (make to-dos, post discussion topics, upload files, etc.).', 'fusion-pm' 290 290 ), 291 291 'decorated_heading' => __( 'People already on the project', 'fusion-pm' ), -
awesome-project-manager/trunk/models/Activity.php
r1814388 r1879390 58 58 } 59 59 60 public function delete_activities_by_column( $ value, $column) {60 public function delete_activities_by_column( $activity_id, $activity_type, $project_id ) { 61 61 62 62 global $wpdb; 63 63 64 $result = $wpdb->get_results( "SELECT `ID` FROM {$this->table_name} WHERE {$column} = {$value}" ); 64 $result = $wpdb->delete( 65 $this->table_name, 66 array( 67 'activity_id' => $activity_id, 68 'activity_type' => $activity_type, 69 'projectID' => $project_id 70 ) 71 ); 65 72 66 foreach ($result as $activity) { 67 $isSuccess = $this->delete($activity->ID); 68 } 69 70 return $isSuccess; 73 return $result; 71 74 } 72 75 … … 87 90 global $wpdb; 88 91 89 $activity_count = $wpdb->get_var( "SELECT COUNT(*) FROM {$this->table_name} WHERE `projectID` = {$project_id}" ); 92 if ( $project_id ) { 93 $activity_count = $wpdb->get_var( 94 "SELECT COUNT(*) FROM {$this->table_name} 95 WHERE `projectID` = {$project_id}" 96 ); 97 } else { 98 $userid = get_current_user_id(); 99 $activity_count = $wpdb->get_var( 100 "SELECT COUNT(*) FROM {$this->table_name} 101 WHERE `userID` = {$userid}" 102 ); 103 } 90 104 91 105 return $activity_count; … … 104 118 } 105 119 106 $result = $wpdb->get_results( "SELECT * FROM {$this->table_name} WHERE `projectID` = {$project_id} ORDER BY `ID` DESC LIMIT {$limit} OFFSET {$offset}" ); 120 if ( $project_id ) { 121 $result = $wpdb->get_results( 122 "SELECT * FROM {$this->table_name} 123 WHERE `projectID` = {$project_id} 124 ORDER BY `ID` DESC LIMIT {$limit} 125 OFFSET {$offset}" 126 ); 127 } else { 128 $userid = get_current_user_id(); 129 $result = $wpdb->get_results( 130 "SELECT * FROM {$this->table_name} 131 WHERE `userID` = {$userid} 132 ORDER BY `ID` DESC LIMIT {$limit} 133 OFFSET {$offset}" 134 ); 135 } 107 136 108 137 if ( $result ) { -
awesome-project-manager/trunk/models/Message.php
r1814388 r1879390 156 156 "SELECT * FROM {$this->table_name} WHERE {$column} = {$param} ORDER BY `ID` DESC LIMIT {$limit} OFFSET {$offset}" 157 157 ); 158 158 if ( !$result ) { 159 return false; 160 } 159 161 foreach ( $result as $messageObject ) { 160 162 $messageObject->avatar_url = get_avatar_url($messageObject->userID, array('size'=>70)); 161 163 $messageObject->formatted_created = $this->get_formatted_date( $messageObject->created ); 162 164 } 165 $result[0]->message_count = $this->get_message_count( $messageObject->projectID ); 163 166 164 167 return $result; -
awesome-project-manager/trunk/models/Todo.php
r1814388 r1879390 147 147 } 148 148 149 public function get_todos_by_column_info( $column , $param ) {149 public function get_todos_by_column_info( $column , $param, $orderBy = NULL ) { 150 150 global $wpdb; 151 151 … … 154 154 } 155 155 156 if( !$param) {156 if( !$param ) { 157 157 return []; 158 158 } 159 159 160 $result = $wpdb->get_results( "SELECT * FROM {$this->table_name} WHERE {$column} = {$param}" ); 160 if ( !$orderBy ) { 161 $orderBy = 'ASC'; 162 } 163 164 $result = $wpdb->get_results( "SELECT * FROM {$this->table_name} WHERE {$column} = {$param} ORDER BY `ID` {$orderBy}" ); 161 165 162 166 foreach ($result as $todo) { -
awesome-project-manager/trunk/readme.txt
r1819244 r1879390 2 2 Contributors: promy89 3 3 Donate Link: http://github/promyaaa/ 4 Tags: manager, project, project management, project manager, todo list5 Requires at least: 4. 86 Tested up to: 4.9. 24 Tags: manager, project, project management, single page app, todo list 5 Requires at least: 4.6 6 Tested up to: 4.9.5 7 7 Stable tag: trunk 8 8 Requires PHP: 5.6 … … 64 64 == Changelog == 65 65 66 v1.0.2 -> May 23, 2018 67 --------------------- 68 - [tweak] libraries moved to vendors directory 69 - [tweak] code refactor 70 - [fix] css issue fix 71 - [new] navigation redesigned 72 66 73 v1.0.1 -> Feb 9, 2018 67 74 ---------------------
Note: See TracChangeset
for help on using the changeset viewer.