/**
  * Builds an array of XML Attributes for javascript onclick linking
  * @param	options			Mixed Array of link parameters, each
  * 							containing...
  * 			link			Array of link parameters for DataCenterUI::url
  * 			field			Singular form of fields
  * 			fields			List of from => to pairs of fields from row to
  * 							inject into link, with the special from fields of
  * 							'#type' and '#category' also made available
  * Example:
  * 		array(
  * 			'link' => array(
  * 				'page' => 'assets',
  * 				'action' => 'view',
  *			),
  *			'fields' => array(
  *				'#type' => 'type',
  *				'id' => 'id',
  *			)
  * 		)
  * @param	row				DataCenterDBRow object from which to extract
  * 							field/fields from
  */
 public static function buildLink($options, $row = null)
 {
     // Checks if row was given
     if (isset($options['page']) && $row instanceof DataCenterDBRow) {
         // Transforms options based on row
         $fields = array_merge($row->get(), array('type' => $row->getType(), 'category' => $row->getCategory()));
         // Loops over each field
         foreach ($fields as $key => $value) {
             // Loops over each option
             foreach ($options as $option => $reference) {
                 if (is_array($options[$option])) {
                     for ($i = 0; $i < count($options[$option]); $i++) {
                         // Checks if value is reference to row field
                         if ('#' . $key == $options[$option][$i]) {
                             // Replaces reference with value
                             $options[$option][$i] = $value;
                         }
                     }
                 } else {
                     // Checks if value is reference to row field
                     if ('#' . $key == $reference) {
                         // Replaces reference with value
                         $options[$option] = $value;
                     }
                 }
             }
         }
     }
     // Builds javascript for linking
     $jsURL = DataCenterJs::escape(DataCenterXml::url($options));
     // Returns XML attributes for link
     return array('onclick' => "window.location='{$jsURL}'");
 }