Plugin Directory

Changeset 1879390


Ignore:
Timestamp:
05/22/2018 07:00:22 PM (8 years ago)
Author:
promy89
Message:

updated to version 1.0.2

Location:
awesome-project-manager/trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • awesome-project-manager/trunk/assets/css/style.css

    r1814388 r1879390  
    197197@media only screen and (min-width: 60em) { /* 960px */
    198198  .container {
    199     width: 75%;
    200     max-width: 60rem;
     199    width: 80%;
     200    max-width: 70rem;
    201201  }
    202202}
  • awesome-project-manager/trunk/classes/class-ajax.php

    r1814388 r1879390  
    2727        add_action( 'wp_ajax_fpm-load-more-projects', array( $this, 'load_more_projects' ), 10 );
    2828
    29         // add_action( 'wp_ajax_fpm-get-message-count', array( $this, 'fetch_message_count' ), 10 );
    3029        add_action( 'wp_ajax_fpm-load-more-messages', array( $this, 'load_more_messages' ), 10 );
    3130        add_action( 'wp_ajax_fpm-load-more-lists', array( $this, 'load_more_lists' ), 10 );
     
    9695    public function create_activity( $data ) {
    9796        $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        }
    98106        $activityModel->create( $data );
    99107    }
     
    225233                'user' => array(
    226234                    'ID' => $user_id,
    227                     'user_name' => $user->display_name,
     235                    'user_name' => $user->user_login,
    228236                    'avatar_url' => get_avatar_url($user_id, array('size'=>50))
    229237                )
     
    265273                'user' => array(
    266274                    'ID' => $user_id,
    267                     'user_name' => $user->display_name,
     275                    'user_name' => $user->user_login,
    268276                    'avatar_url' => get_avatar_url($user_id, array('size'=>50))
    269277                )
     
    351359        $messageModel = FusionPM_Message::init();
    352360
    353         $userObject = get_user_by( 'ID', get_current_user_id() );
     361        $userObject = wp_get_current_user();
    354362
    355363        $date = current_time( 'mysql' );
     
    360368            'userID' => $userObject->ID,
    361369            'projectID' => $projectID,
    362             'user_name' => $userObject->display_name,
     370            'user_name' => $userObject->user_login,
    363371            'project_title' => $projectTitle,
    364             'file_ids' => maybe_serialize( $fileIDs ),
    365             'created' => $date
     372            'file_ids' => maybe_serialize( $fileIDs )
    366373        );
    367374
     
    370377            $successResponse = $messageModel->update( $data, $where );
    371378        } else {
     379            $data['created'] = $date;
    372380            $insertID = $messageModel->create( $data );
    373381        }
     
    383391        );
    384392
     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
    385407        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' => $date
    395             );
    396 
    397             $this->create_activity($activities);
    398 
    399408            wp_send_json_success( $resp );
    400409        }
     
    417426            wp_send_json_error( __( 'messageid not provided', 'fusion-pm' ) );
    418427        }
    419 
     428        $userObject = wp_get_current_user();
    420429        $messageModel = FusionPM_Message::init();
    421430        $delete = $messageModel->delete( $messageID );
     
    423432        if( $delete ) {
    424433            $activities = array(
    425                 'userID' => $userID,
    426                 'user_name' => $userName,
     434                'userID' => $userObject->ID,
     435                'user_name' => $userObject->user_login,
    427436                'projectID' => $projectID,
    428437                'activity_id' => $messageID,
     
    520529            'projectID' => $projectID,
    521530            'userID' =>  $current_user->ID,
    522             'user_name' =>  $current_user->display_name,
    523             'created' => $date
     531            'user_name' =>  $current_user->user_login
    524532        );
    525533
     
    528536            $successResponse = $commentModel->update( $data, $where );
    529537        } else {
     538            $data['created'] = $date;
    530539            $insertID = $commentModel->create( $data );
    531540        }
     
    554563        $assigneeID = get_current_user_id();
    555564
     565        $orderBy = $this->get_validated_input('order_by');
     566
    556567        $todoModel = FusionPM_Todo::init();
    557568
     
    684695       
    685696        $date = current_time( 'mysql' );
     697        $userObject = wp_get_current_user();
    686698
    687699        $data = array(
    688700            'todo' => $todo,
    689701            'listID' => $listID,
    690             'userID' => get_current_user_id(),
    691702            'projectID' => $projectID,
    692             'userID' => $userID,
    693             'user_name' => $userName,
     703            'userID' => $userObject->ID,
     704            'user_name' => $userObject->user_login,
    694705            'assignee_name' => $assigneeName,
    695706            'assigneeID' => $assigneeID,
    696707            'file_ids' => maybe_serialize( $fileIDs ),
    697             'due_date' => $dueDate,
    698             'created' => $date
     708            'due_date' => $dueDate
    699709        );
    700710
     
    703713            $successResponse = $todosModel->update( $data, $where );
    704714        } else {
     715            $data['created'] = $date;
    705716            $insertID = $todosModel->create( $data );
    706717        }
     
    714725
    715726        $resp = array(
    716             'message' => __( 'Successfully inserted', 'fusion-pm' ),
     727            'message' => __( 'operation successful', 'fusion-pm' ),
    717728            'todo' => array(
    718729                'ID' => $insertID ? $insertID : $todoID,
     
    725736        );
    726737
     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
    727753        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' => $date
    738             );
    739 
    740             $this->create_activity($activities);
    741 
    742754            wp_send_json_success( $resp );
    743755        }
     
    767779            $activities = array(
    768780                'userID' => $userObject->ID,
    769                 'user_name' => $userObject->display_name,
     781                'user_name' => $userObject->user_login,
    770782                'projectID' => $projectID,
    771783                'activity_id' => $todoID,
     
    791803        $listID = !empty( $_POST['list_id'] ) ? $_POST['list_id'] : '';
    792804        $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'] : '';
    795807        $todo = !empty( $_POST['todo'] ) ? $_POST['todo'] : '';
    796 
     808        $currentUser = wp_get_current_user();
    797809        if( ! $todoID ) {
    798810            wp_send_json_error( __( 'todoid not provided', 'fusion-pm' ) );
     
    807819
    808820        $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,
    813825            'activity_id' => $todoID,
    814             'activity' => $todo,
    815             'created' => $date
     826            'activity'    => $todo,
     827            'created'     => $date
    816828        );
    817829
     
    862874
    863875        $date = current_time( 'mysql' );
     876        $userObject = wp_get_current_user();
    864877
    865878        $data = array(
    866879            '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
    871883        );
    872884
     
    877889            $successResponse = $listModel->update( $data, $where );
    878890        } else {
     891            $data['created'] = $date;
    879892            $insertID = $listModel->create( $data );
    880893        }
     
    959972            'project_title' => $project_title,
    960973            'project_desc' => $project_desc,
    961             'userID' => get_current_user_id(),
    962             'created' => $date
     974            'userID' => get_current_user_id()
    963975        );
    964976
     
    969981            $successResponse = $projectModel->update( $data, $where );
    970982        } else {
     983            $data['created'] = $date;
    971984            $insertID = $projectModel->create( $data );
    972985        }
     
    11391152        $projectID = $this->get_validated_input('project_id');
    11401153
    1141         if(!$projectID) {
    1142             wp_send_json_error( __( 'projectid not provided', 'fusion-pm' ) );
    1143         }
    1144 
    11451154        $activityModel = FusionPM_Activity::init();
    11461155        $activites = $activityModel->get_project_activities( $projectID );
  • awesome-project-manager/trunk/classes/class-install.php

    r1814388 r1879390  
    9393                `user_name` varchar(100),
    9494                `projectID` int(11) unsigned,
    95                 `listID` int(11) unsigned,
     95                `parentID` int(11) unsigned,
    9696                `activity_id` int(11) unsigned,
    9797                `activity_type` varchar(50),
  • awesome-project-manager/trunk/classes/class-localize.php

    r1814388 r1879390  
    9191            'add_remove_people'        => __( 'Add/Remove People...', 'fusion-pm' ),
    9292            'todos'                    => __( 'To-dos', 'fusion-pm' ),
    93             'message_board'            => __( 'Message Board', 'fusion-pm' ),
     93            'message_board'            => __( 'Discussion', 'fusion-pm' ),
    9494            'project_activity'         => __( 'Project Activity', 'fusion-pm' ),
    9595            'create_a_todo'            => __( 'created a Todo', 'fusion-pm' ),
     
    9999            'checked_off_todo'         => __( 'checked off a Todo', 'fusion-pm' ),
    100100            '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' ),
    104104            'no_activity_yet'          => __( 'No activiy yet.', 'fusion-pm' ),
    105105        );
     
    180180    public function messages_localize_data() {
    181181        $localize_data = array(
    182             'add_new_msg_btn'      => __( 'Add New Message', 'fusion-pm' ),
    183             'message_heading'      => __( 'Message Board', 'fusion-pm' ),
    184             'no_message_yet'      => __( 'No Message Added 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' ),
    185185            'posted_by'      => __( 'posted by', 'fusion-pm' ),
    186186            'loading'              => __( 'Loading ...', 'fusion-pm' ),
     
    200200    public function single_messages_localize_data() {
    201201        $localize_data = array(
    202             'add_new_msg_btn'      => __( 'Add New Message', 'fusion-pm' ),
    203             'message_heading'      => __( 'Message Board', 'fusion-pm' ),
    204             'no_message_yet'      => __( 'No Message Added 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' ),
    205205            'posted_by'      => __( 'posted by', 'fusion-pm' ),
    206206            'loading'              => __( 'Loading ...', 'fusion-pm' ),
     
    228228    public function new_messages_localize_data() {
    229229        $localize_data = array(
    230             'message_label'             => __( 'Messages', 'fusion-pm' ),
    231             'message_title_placeholder' => __( 'Enter your message title...', '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' ),
    233233            'edit'                      => __( 'Edit', 'fusion-pm' ),
    234234            'delete'                    => __( 'Delete', 'fusion-pm' ),
     
    250250    public function edit_messages_localize_data() {
    251251        $localize_data = array(
    252             'message_label'             => __( 'Messages', 'fusion-pm' ),
    253             'message_title_placeholder' => __( 'Enter your message title...', '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' ),
    255255            'edit'                      => __( 'Edit', 'fusion-pm' ),
    256256            'delete'                    => __( 'Delete', 'fusion-pm' ),
     
    287287            'header_label'              => __( 'Set up who’s on ', 'fusion-pm' ),
    288288            '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'
    290290                                                ),
    291291            'decorated_heading'         => __( 'People already on the project', 'fusion-pm' ),
  • awesome-project-manager/trunk/models/Activity.php

    r1814388 r1879390  
    5858    }
    5959
    60     public function delete_activities_by_column( $value, $column ) {
     60    public function delete_activities_by_column( $activity_id, $activity_type, $project_id ) {
    6161
    6262        global $wpdb;
    6363
    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        );
    6572
    66         foreach ($result as $activity) {
    67             $isSuccess = $this->delete($activity->ID);
    68         }
    69 
    70         return $isSuccess;
     73        return $result;
    7174    }
    7275
     
    8790        global $wpdb;
    8891
    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        }
    90104
    91105        return $activity_count;
     
    104118        }
    105119
    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        }
    107136
    108137        if ( $result ) {
  • awesome-project-manager/trunk/models/Message.php

    r1814388 r1879390  
    156156            "SELECT * FROM {$this->table_name} WHERE {$column} = {$param} ORDER BY `ID` DESC LIMIT {$limit} OFFSET {$offset}"
    157157        );
    158 
     158        if ( !$result ) {
     159            return false;
     160        }
    159161        foreach ( $result as $messageObject ) {
    160162            $messageObject->avatar_url = get_avatar_url($messageObject->userID, array('size'=>70));
    161163            $messageObject->formatted_created = $this->get_formatted_date( $messageObject->created );
    162164        }
     165        $result[0]->message_count = $this->get_message_count( $messageObject->projectID );
    163166
    164167        return $result;
  • awesome-project-manager/trunk/models/Todo.php

    r1814388 r1879390  
    147147    }
    148148
    149     public function get_todos_by_column_info( $column , $param ) {
     149    public function get_todos_by_column_info( $column , $param, $orderBy = NULL ) {
    150150        global $wpdb;
    151151
     
    154154        }
    155155
    156         if(!$param) {
     156        if( !$param ) {
    157157            return [];
    158158        }
    159159
    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}" );
    161165
    162166        foreach ($result as $todo) {
  • awesome-project-manager/trunk/readme.txt

    r1819244 r1879390  
    22Contributors:  promy89
    33Donate Link: http://github/promyaaa/
    4 Tags: manager, project, project management, project manager, todo list
    5 Requires at least: 4.8
    6 Tested up to: 4.9.2
     4Tags: manager, project, project management, single page app, todo list
     5Requires at least: 4.6
     6Tested up to: 4.9.5
    77Stable tag: trunk
    88Requires PHP: 5.6
     
    6464== Changelog ==
    6565
     66v1.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
    6673v1.0.1 -> Feb 9, 2018
    6774---------------------
Note: See TracChangeset for help on using the changeset viewer.