ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Style_Protection Class Reference
+ Inheritance diagram for PHPExcel_Style_Protection:
+ Collaboration diagram for PHPExcel_Style_Protection:

Public Member Functions

 __construct ($isSupervisor=false)
 Create a new PHPExcel_Style_Protection.
 bindParent ($parent)
 Bind parent.
 getIsSupervisor ()
 Is this a supervisor or a real style component?
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet.
 getActiveSheet ()
 Get the currently active sheet.
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet.
 getActiveCell ()
 Get the currently active cell coordinate in currently active sheet.
 getStyleArray ($array)
 Build style array from subcomponents.
 applyFromArray ($pStyles=null)
 Apply styles from array.
 getLocked ()
 Get locked.
 setLocked ($pValue=self::PROTECTION_INHERIT)
 Set locked.
 getHidden ()
 Get hidden.
 setHidden ($pValue=self::PROTECTION_INHERIT)
 Set hidden.
 getHashCode ()
 Get hash code.
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.

Data Fields

const PROTECTION_INHERIT = 'inherit'
 Protection styles.
const PROTECTION_PROTECTED = 'protected'
const PROTECTION_UNPROTECTED = 'unprotected'

Private Attributes

 $_locked
 $_hidden
 $_parentPropertyName
 $_isSupervisor
 $_parent

Detailed Description

Definition at line 36 of file Protection.php.

Constructor & Destructor Documentation

PHPExcel_Style_Protection::__construct (   $isSupervisor = false)

Create a new PHPExcel_Style_Protection.

Definition at line 81 of file Protection.php.

References PROTECTION_INHERIT.

{
// Supervisor?
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_locked = self::PROTECTION_INHERIT;
$this->_hidden = self::PROTECTION_INHERIT;
}

Member Function Documentation

PHPExcel_Style_Protection::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Definition at line 271 of file Protection.php.

{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
PHPExcel_Style_Protection::applyFromArray (   $pStyles = null)

Apply styles from array.

$objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array('locked' => true, 'hidden' => false) );

Parameters
array$pStylesArray containing style information
Exceptions
Exception
Returns
PHPExcel_Style_Protection

Definition at line 178 of file Protection.php.

References getActiveSheet(), getSelectedCells(), getStyleArray(), setHidden(), and setLocked().

{
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else {
if (array_key_exists('locked', $pStyles)) {
$this->setLocked($pStyles['locked']);
}
if (array_key_exists('hidden', $pStyles)) {
$this->setHidden($pStyles['hidden']);
}
}
} else {
throw new Exception("Invalid style array passed.");
}
return $this;
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::bindParent (   $parent)

Bind parent.

Only used for supervisor

Parameters
PHPExcel_Style$parent
Returns
PHPExcel_Style_Protection

Definition at line 97 of file Protection.php.

{
$this->_parent = $parent;
return $this;
}
PHPExcel_Style_Protection::getActiveCell ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 151 of file Protection.php.

References getActiveSheet().

{
return $this->getActiveSheet()->getActiveCell();
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getActiveSheet ( )

Get the currently active sheet.

Only used for supervisor

Returns
PHPExcel_Worksheet

Definition at line 129 of file Protection.php.

Referenced by applyFromArray(), getActiveCell(), getSelectedCells(), setHidden(), and setLocked().

{
return $this->_parent->getActiveSheet();
}

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 257 of file Protection.php.

References getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode();
}
return md5(
$this->_locked
. $this->_hidden
. __CLASS__
);
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getHidden ( )

Get hidden.

Returns
string

Definition at line 229 of file Protection.php.

References $_hidden, and getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHidden();
}
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getIsSupervisor ( )

Is this a supervisor or a real style component?

Returns
boolean

Definition at line 108 of file Protection.php.

References $_isSupervisor.

{
}
PHPExcel_Style_Protection::getLocked ( )

Get locked.

Returns
string

Definition at line 201 of file Protection.php.

References $_locked, and getSharedComponent().

{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getLocked();
}
}

+ Here is the call graph for this function:

PHPExcel_Style_Protection::getSelectedCells ( )

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Returns
string E.g. 'A1'

Definition at line 140 of file Protection.php.

References getActiveSheet().

Referenced by applyFromArray(), setHidden(), and setLocked().

{
return $this->getActiveSheet()->getSelectedCells();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::getSharedComponent ( )

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor

Returns
PHPExcel_Style_Protection

Definition at line 119 of file Protection.php.

Referenced by getHashCode(), getHidden(), and getLocked().

{
return $this->_parent->getSharedComponent()->getProtection();
}

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 162 of file Protection.php.

Referenced by applyFromArray(), setHidden(), and setLocked().

{
return array('protection' => $array);
}

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::setHidden (   $pValue = self::PROTECTION_INHERIT)

Set hidden.

Parameters
string$pValue
Returns
PHPExcel_Style_Protection

Definition at line 242 of file Protection.php.

References getActiveSheet(), getSelectedCells(), and getStyleArray().

Referenced by applyFromArray().

{
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('hidden' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_hidden = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Style_Protection::setLocked (   $pValue = self::PROTECTION_INHERIT)

Set locked.

Parameters
string$pValue
Returns
PHPExcel_Style_Protection

Definition at line 214 of file Protection.php.

References getActiveSheet(), getSelectedCells(), and getStyleArray().

Referenced by applyFromArray().

{
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('locked' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_locked = $pValue;
}
return $this;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

PHPExcel_Style_Protection::$_hidden
private

Definition at line 55 of file Protection.php.

Referenced by getHidden().

PHPExcel_Style_Protection::$_isSupervisor
private

Definition at line 69 of file Protection.php.

Referenced by getIsSupervisor().

PHPExcel_Style_Protection::$_locked
private

Definition at line 48 of file Protection.php.

Referenced by getLocked().

PHPExcel_Style_Protection::$_parent
private

Definition at line 76 of file Protection.php.

PHPExcel_Style_Protection::$_parentPropertyName
private

Definition at line 62 of file Protection.php.

const PHPExcel_Style_Protection::PROTECTION_UNPROTECTED = 'unprotected'

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