* version 3 of the License, or any later version.
* 
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('collaboration');
if (isset($_POST['tid']) && isset($_POST['event']) && isset($_POST['reason'])) {
    if (strcasecmp(OC_Collaboration_Task::getWorkingMember($_POST['tid']), OC_User::getUser()) != 0) {
        throw new Exception(OC_User::getUser() . ' is trying to change status of task ' . $_POST['tid']);
        OC_JSON::error();
        exit;
    }
    $tid = $_POST['tid'];
    $title = OC_Collaboration_Task::getTaskTitle($tid);
    $status = OC_Collaboration_Task::getStatusFromPerformerEvent($_POST['event']);
    $creator = OC_User::getUser();
    OC_Collaboration_Task::changeStatus($tid, $title, $status, $creator, NULL, $_POST['reason'], false);
    OCP\JSON::success(array());
    exit;
}
OC_Log::write('collaboration', $_POST['tid'] . ' ' . $_POST['event'] . ' ' . $_POST['reason'], OCP\Util::DEBUG);
OC_JSON::error();
exit;
                p('btn_edit_' . $each['tid']);
                ?>
" >
												<?php 
                p($l->t('Edit'));
                ?>
											</button>
										</div>
						  	  <?php 
            }
            ?>
								<?php 
        }
        ?>
                <?php 
        if (strcasecmp(OC_Collaboration_Task::getWorkingMember($each['tid']), OC_User::getUser()) == 0) {
            print_unescaped('<div class="status_event" data-tid="' . $each['tid'] . '" >');
            $ev_stat = OC_Collaboration_Task::getEventStatus($each['status'], 'Performer');
            foreach ($ev_stat as $event => $status) {
                print_unescaped('<button class="event_btn" value="' . $event . '" >' . OC_Collaboration_Task::translateEvent($event) . '</button>');
            }
            print_unescaped('</div>');
        }
        ?>
            </div>
					</div>
				</div>
      </div>
    </div>
	<?php 
    }