Exemplo n.º 1
0
 public static function details($accountKey = false)
 {
     if ($accountKey) {
         $account = $_SESSION['usernames'][$accountKey];
     } else {
         $account = $_SESSION['current'];
     }
     $templateData = array('template' => 'accounts/details', 'title' => 'Migrate - Account details', 'bodyId' => 'accounts-details', 'styles' => array('accounts.css'), 'scripts' => array('accounts.js'), 'account' => $account, 'services' => ServicesModel::withPermissions(), 'selectedServices' => UsersServicesModel::all(array('user_id' => $account['username']['id']))->column('service_id'), 'tasks' => TasksModel::listingFor(array('user_id' => $account['username']['id'], 'user_affected_id' => $account['username']['id'])), 'intro' => (bool) IntroModel::first(array('page' => 'profile', 'group' => $_SESSION['current']['username']['group'])));
     if (!$templateData['intro']) {
         IntroModel::create(array('page' => 'profile', 'group' => $_SESSION['current']['username']['group']))->save();
     }
     \Render::layout('template', $templateData);
 }
Exemplo n.º 2
0
 /**
  * Dashboard index page
  */
 public static function index($finish = false)
 {
     if ($finish) {
         \Auth::showWizard('finish');
     } else {
         if (\Auth::showWizard()) {
             \Router::redirect('accounts/permissions');
         }
     }
     $templateData = array('template' => 'dashboard/content', 'title' => 'Migrate - Dashboard', 'bodyId' => 'dashboard', 'styles' => array('dashboard.css'), 'scripts' => array(), 'queue' => TasksModel::listingFor(array('user_id' => $_SESSION['current']['username']['id'], 'user_affected_id' => $_SESSION['current']['username']['id']), 4), 'services' => ServicesModel::forUser(array('id' => $_SESSION['current']['username']['id'], 'limit' => 4)), 'usernames' => $_SESSION['usernames'], 'intro' => (bool) IntroModel::first(array('page' => 'dashboard', 'group' => $_SESSION['current']['username']['group'])));
     if (!$templateData['intro']) {
         IntroModel::create(array('page' => 'dashboard', 'group' => $_SESSION['current']['username']['group']))->save();
     }
     \Render::layout('template', $templateData);
 }
Exemplo n.º 3
0
 /**
  * Listing accounts
  */
 public static function index($selectedService = 0)
 {
     // Clean Init
     if (!isset($_SESSION['clean']) || !$_SESSION['clean']) {
         // Services
         next($_SESSION['current']['services']);
         $first = current($_SESSION['current']['services']);
         $_SESSION['clean']['service'] = $first['service_id'];
         // Data
         $_SESSION['clean']['selectedData'] = array();
     }
     $templateData = array('template' => 'clean/content', 'title' => 'Migrate - Clean', 'bodyId' => 'clean', 'styles' => array('common/wizard.css', 'clean/clean.css'), 'scripts' => array('common/wizard.js', 'clean/clean.js'), 'services' => $_SESSION['current']['services'], 'polling' => TasksModel::listingFor(array('user_id' => $_SESSION['current']['username']['id'], 'type' => TasksModel::TYPE_CLEAN, 'status' => array(TasksModel::STATUS_SCHEDULED, TasksModel::STATUS_PROGRESS, TasksModel::STATUS_REVERTING))) ? 'yes' : 'no', 'tasks' => TasksModel::listingFor(array('user_id' => $_SESSION['current']['username']['id'], 'type' => TasksModel::TYPE_CLEAN)), 'intro' => (bool) IntroModel::first(array('page' => 'clean', 'group' => $_SESSION['current']['username']['group'])));
     if (!$templateData['intro']) {
         IntroModel::create(array('page' => 'clean', 'group' => $_SESSION['current']['username']['group']))->save();
     }
     \Render::layout('template', $templateData);
 }
Exemplo n.º 4
0
 /**
  * Listing accounts
  */
 public static function index($source = -1, $destination = -1)
 {
     \Auth::showWizard('finish');
     // Wizard Init
     if (!isset($_SESSION['wizard'])) {
         $_SESSION['wizard']['action'] = 0;
         $_SESSION['wizard']['services'] = array();
     }
     static::_setUsers($source, $destination);
     $source = static::_getUser('source');
     $destination = static::_getUser('destination');
     $_SESSION['wizard']['commonServices'] = isset($source['services']) && isset($destination['services']) ? @array_intersect_assoc($source['services'], $destination['services']) : array();
     $templateData = array('template' => 'migrate/content', 'title' => 'Migrate - Migrate', 'bodyId' => 'migrate', 'styles' => array('common/wizard.css', 'migrate/migrate.css'), 'scripts' => array('common/wizard.js', 'migrate/migrate.js'), 'source' => $source, 'destination' => $destination, 'services' => $_SESSION['wizard']['commonServices'], 'polling' => TasksModel::listingFor(array('user_id' => $_SESSION['current']['username']['id'], 'user_affected_id' => $_SESSION['current']['username']['id'], 'type' => array(TasksModel::TYPE_SYNC, TasksModel::TYPE_MIGRATE, TasksModel::TYPE_MOVE), 'status' => array(TasksModel::STATUS_SCHEDULED, TasksModel::STATUS_PROGRESS, TasksModel::STATUS_REVERTING))) ? 'yes' : 'no', 'tasks' => TasksModel::listingFor(array('user_id' => $_SESSION['current']['username']['id'], 'user_affected_id' => $_SESSION['current']['username']['id'], 'type' => array(TasksModel::TYPE_SYNC, TasksModel::TYPE_MIGRATE, TasksModel::TYPE_MOVE))), 'disabled' => count($_SESSION['usernames']) > 1 ? '' : 'disabled', 'intro' => (bool) IntroModel::first(array('page' => 'migrate', 'group' => $_SESSION['current']['username']['group'])));
     if (!$templateData['intro']) {
         IntroModel::create(array('page' => 'migrate', 'group' => $_SESSION['current']['username']['group']))->save();
     }
     if ($templateData['disabled']) {
         \Util::notice(array('type' => 'warning', 'text' => 'This operation requires at least two accounts. Click <a href="' . \Render::link('accounts/add') . '">here</a> to add another account.', 'persistent' => true));
     }
     \Render::layout('template', $templateData);
 }