Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
ImportController Class Reference
Inheritance diagram for ImportController:
Controller BaseController

Public Member Functions

 filters ()
 accessRules ()
 renderImportTableRow (&$importFile, $index, $csv_row)
 actionIndex ()

Additional Inherited Members

- Public Attributes inherited from Controller
 $menu = array()
 $breadcrumbs = array()
- Protected Member Functions inherited from BaseController
 beforeAction ($action)

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

ImportController controller class file.

Definition at line 12 of file ImportController.php.

Member Function Documentation

ImportController::accessRules ( )

Specifies the access control rules. Allows access for admins only

Returns
array access control rules

Definition at line 33 of file ImportController.php.

{
return array(
array('deny', // deny all users
'actions' => array('delete'),
'users' => array('*'),
),
array('allow', // allow authenticated users to access all actions
'roles'=>array('Admin'),
),
array('deny'),
);
}
ImportController::filters ( )

Sets filter for CRUD operations in this case

Returns
array action filters

Definition at line 18 of file ImportController.php.

{
return CMap::mergeArray(
parent::filters(),
array(
'accessControl', // perform access control for CRUD operations
)
);
}
ImportController::renderImportTableRow ( $importFile,
  $index,
  $csv_row 
)

Method renders a row for the table comprising the import date

Returns
html markup with date

Definition at line 50 of file ImportController.php.

{
if(!$csv_row){
return;
}
$user = $importFile->getUserFromCsvRow($csv_row);
$profile = $importFile->getProfileFromCsvRow($csv_row);
if(isset($_POST['submit_validate'])||isset($_POST['submit_import'])){
importFile::overrideExisted($user,$profile);
}
if(isset($_POST['submit_validate'])){
if(!isset($importFile->valid)){
$importFile->valid = true;
}
if(isset($_POST['enable_override'])){
$user->setScenario('nameIsNotUniq');
}
if(!($user->getIsNewRecord() && !isset($_POST['enable_override']))){
$importFile->valid = $user->validate($importFile->getFieldNames()) && $importFile->valid;
if($profile){
$importFile->valid = $profile->validate($importFile->getFieldNames()) && $importFile->valid;
}
}
if(!$importFile->valid){
$importFile->assignError();
}
}//end submit_import || submit_validate
if(isset($_POST['submit_import'])){
$importFile->valid = (isset($_POST['valid'])&&$_POST['valid']==1)? true: false;
if($importFile->valid){
if($user->getIsNewRecord() || (!$user->getIsNewRecord() && isset($_POST['enable_override']))){
$user->save(false);
$user->justSaved = true;
if($profile){
$profile->user_id = $user->id;
$profile->save(false);
}
}
}
}
return $this->renderPartial('user.views.import._import_table_row',array(
'importFile' => $importFile,
'user' => $user,
'profile' => $profile,
'index' => $index
), true);
unset($user);
unset($profile);
}

The documentation for this class was generated from the following file: