/**
 * Populate $objects with objects that $user can see
 *
 * @param Milestone $milestone
 * @param array $objects
 * @param User $user
 * @return null
 */
function checklists_handle_on_milestone_objects(&$milestone, &$objects, &$user)
{
    if ($user->getProjectPermission('checklist', $milestone->getProject()) >= PROJECT_PERMISSION_ACCESS) {
        $objects[lang('Checklists')] = Checklists::findByMilestone($milestone, STATE_VISIBLE, $user->getVisibility());
    }
    // if
}
/**
 * Handle on_copy_project_items event
 *
 * @param Project $from
 * @param Project $to
 * @param array $milestones_map
 * @param array $categories_map
 * @return null
 */
function checklists_handle_on_copy_project_items(&$from, &$to, $milestones_map, $categories_map)
{
    $checklists = Checklists::findByProject($from, STATE_VISIBLE, VISIBILITY_PRIVATE);
    if (is_foreachable($checklists)) {
        foreach ($checklists as $checklist) {
            $checklist->copyToProject($to, array_var($milestones_map, $checklist->getMilestoneId()), null, array('Task'));
        }
        // foreach
    }
    // if
}
Пример #3
0
<?php

require_once 'includes/session.php';
//Imports
require_once 'includes/db.php';
require_once 'includes/Checklist.php';
if ($_SESSION['USER_GRP'] !== 1) {
    header('Location: ./');
    exit;
}
$con = connect_db();
$lists = new Checklists();
$lists->get($con);
$con->close();
?>

<!DOCTYPE html>
<html>
<head>
	<title>Vehicle Checklist</title>
	
	<meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
	
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
	<link href="css/style.css" rel="stylesheet" />	

	<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
	<script src="js/script.js" defer="defer"></script>
/**
 * Populate $objects with objects that are in $visibility domain
 *
 * @param Milestone $milestone
 * @param array $objects
 * @param integer $visibility
 * @return null
 */
function checklists_handle_on_milestone_objects_by_visibility(&$milestone, &$objects, $visibility)
{
    $objects[lang('Checklists')] = Checklists::findByMilestone($milestone, STATE_VISIBLE, $visibility);
}
 /**
  * Export project checklists
  *
  * @param void
  * @return null
  */
 function export()
 {
     $object_visibility = array_var($_GET, 'visibility', VISIBILITY_NORMAL);
     $exportable_modules = explode(',', array_var($_GET, 'modules', null));
     if (!is_foreachable($exportable_modules)) {
         $exportable_modules = null;
     }
     // if
     require_once PROJECT_EXPORTER_MODULE_PATH . '/models/ProjectExporterOutputBuilder.class.php';
     $output_builder = new ProjectExporterOutputBuilder($this->active_project, $this->smarty, $this->active_module, $exportable_modules);
     if (!$output_builder->createOutputFolder()) {
         $this->serveData($output_builder->execution_log, 'execution_log', null, FORMAT_JSON);
     }
     // if
     $output_builder->createAttachmentsFolder();
     $completed_checklists = Checklists::findCompletedByProject($this->active_project, STATE_VISIBLE, $object_visibility);
     $active_checklists = Checklists::findActiveByProject($this->active_project, STATE_VISIBLE, $object_visibility);
     $checklists = array_merge((array) $completed_checklists, (array) $active_checklists);
     // export checklists front page
     $output_builder->setFileTemplate($this->active_module, $this->controller_name, 'index');
     $output_builder->smarty->assign('active_objects', $active_checklists);
     $output_builder->smarty->assign('completed_objects', $completed_checklists);
     $output_builder->outputToFile('index');
     if (is_foreachable($checklists)) {
         $output_builder->setFileTemplate($this->active_module, $this->controller_name, 'object');
         foreach ($checklists as $checklist) {
             if (instance_of($checklist, 'Checklist')) {
                 $output_builder->smarty->assign(array('object' => $checklist));
                 $output_builder->outputToFile('checklist_' . $checklist->getId());
             }
             // if
         }
         // foreach
     }
     // if
     $this->serveData($output_builder->execution_log, 'execution_log', null, FORMAT_JSON);
 }
 public function savemigrarAction()
 {
     $msm = '';
     if (isset($_POST['contrato_id_migrar'])) {
         $contrato_id = $_POST['contrato_id'];
         $contrato_id_migrar = $_POST['contrato_id_migrar'];
         $model = new Checklists();
         $resul = $model->migrar($contrato_id, $contrato_id_migrar);
         $msm = 'Se migro correctamente';
     }
     $this->view->disable();
     echo $msm;
 }
 /**
  * List of checklists
  *
  */
 function index()
 {
     $this->addBreadcrumb(lang('List'));
     $checklists = Checklists::findActiveByProject($this->active_project, STATE_VISIBLE, $this->logged_user->getVisibility());
     $this->smarty->assign(array('checklists' => $checklists, 'page_back_url' => assemble_url('mobile_access_view_project', array('project_id' => $this->active_project->getId()))));
 }